Re: [R] problem with dates in zoo package

2009-02-17 Thread Gabor Grothendieck
See ?which.max : library(zoo) z <- read.zoo("myfile.dat", sep = ",", format = "%m/%d/%Y") f <- function(x) time(x)[which.max(x)] ix <- tapply(z, floor(as.yearmon(time(z))), f) z[ix] On Tue, Feb 17, 2009 at 3:58 AM, CJ Rubio wrote: > > i have the following code - assimilating the maximum annual

[R] problem with dates in zoo package

2009-02-17 Thread CJ Rubio
i have the following code - assimilating the maximum annual discharge each year ffrom a daily discharge record from year 1989-2005. m <- read.table("D:/documents/5 stations/01014000.csv", sep =",") z <- zoo(m[,4],as.Date(as.character(m[,3]), "%m/%d/%Y")) x <- aggregate(z, floor(as.numeric(as.yea