[R] How to get the date of specific value within a zoo object?

Richard Ma xuanlong.ma at uts.edu.au
Wed Aug 10 04:39:40 CEST 2011


Hi all,

I have a zoo time series object, see below code:
-------------------------------------------------------------------------------------------

# This is a pasteable example
library(zoo)

x <- c(1, 2, 3, 4, 5)
dt <- c("2011-01-01", "2011-01-02", "2011-01-03", "2011-01-04", "201-01-05")
ts <- zoo(x, ts)

-------------------------------------------------------------------------------------------

Now, I want to know the date when 'ts' equal to a specific value. In this
example, suppose I want to know when the ts = 3? The program should return
"2011-01-03".

Is there a function to do this job conveniently?

Regards,
Richard

-----
Richard Ma
PhD student, Ecology & Remote Sensing
Climate Change Cluster, Department of Environment Science
University of Technology, Sydney
http://everydropr.wordpress.com
--
View this message in context: http://r.789695.n4.nabble.com/How-to-get-the-date-of-specific-value-within-a-zoo-object-tp3731885p3731885.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list