Skip to content
Prev 170728 / 398502 Next

problem with dates in zoo package

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.yearmon(time(z)))), max)   #code
suggested by Gabor Grothendieck

which gives me the maximum discharge each year and the year itself.. what i
am trying now is to produce the date when the maximum discharge was observed
in the pattern yyyy-mm-dd, like:

1988     11/9/1988      18600
1989      5/8/1989       49000
...
2005     4/26/2005    111000 

thank you all in advance...