Try this: > library(zoo) > set.seed(1) > z <- zoo(rnorm(100), as.Date(0) + 1:100) > mx <- z[which.max(z)]; mx 1970-03-03 2.401618 > coredata(mx) [1] 2.401618 > time(mx) [1] "1970-03-03"
On Sat, Feb 13, 2010 at 3:39 PM, Edouard Tallent <[email protected]> wrote: > hi everyone. > i am dealing on a zoo-class object.i am aware of the 'min' and 'max' function > to get the minimum and the maximum values.getting these maximum and minimum > values is ont thing.but, how to get the (zoo) dates these values occur ? > in fact, in analysing a time series i am interested in the particular > (extreme) values AND in the moments they happen. > regards.edouard. > > [[alternative(swapped) HTML version deleted]] > > This is MIME Epilogue > > ______________________________________________ > [email protected] mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > ______________________________________________ [email protected] mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.

