[R-SIG-Finance] How to spot lowest or Highest points from timeSeries object in Rmetrics library

Lüthi David (XICD 1) david.luethi at claridenleu.com
Thu Sep 16 11:42:27 CEST 2010


Hi Josh
To get the date of the minimum observation: time(data)[which.min(data)]
To get the data as timeSeries: data[which.min(data), drop = FALSE] 
Best,
david

-----Original Message-----
From: r-sig-finance-bounces at stat.math.ethz.ch [mailto:r-sig-finance-bounces at stat.math.ethz.ch] On Behalf Of JOSH C. CHIEN
Sent: Thursday, September 16, 2010 11:32 AM
To: r-sig-finance at stat.math.ethz.ch
Subject: [R-SIG-Finance] How to spot lowest or Highest points from timeSeries object in Rmetrics library

Hi all,
In my case, I just want to know what date is the lowest point in time
series.

Library(fPortfolio)
data(SWX)
data <- SWX[,"SPI"]
> class(data)
[1] "timeSeries"
attr(,"package")
[1] "timeSeries"
> min(data)
[1] 2603.37
> data[,min(data)]

It's not work for what I want.

I have ever tried "order" function. It's also not work.

how to get the data date for 2603.37 from this case ?

thank a lot.

Josh

	[[alternative HTML version deleted]]

_______________________________________________
R-SIG-Finance at stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-sig-finance
-- Subscriber-posting only. If you want to post, subscribe first.
-- Also note that this is not the r-help list where general R questions should go.



More information about the R-SIG-Finance mailing list