Re: [R] finding the annual maximun within several years

2007-11-13 Thread Gabor Grothendieck
We can do this using chron and zoo. First turn it into a zoo series, z, using chron times, tt, which may not only be useful for this but also for other purposes. The ave(...) command gets a vector as long as the series with the minimum dates in year each and then we aggregate z by that using max.

Re: [R] finding the annual maximun within several years

2007-11-13 Thread Prof Brian Ripley
I presume you want this separately for each of V3, V4 and V5, and illustrated V4? Let's first create a new column for the year. If the table is 'tab': tab$year <- substring(tab$V1, 7) Then by() almost does the job, but we need to reformat the result. myfun <- function(tab, col) { i <- whi

[R] finding the annual maximun within several years

2007-11-12 Thread Dörte Salecker
dear r-helpers i've got a table that in extracts looks like this: V1 V2 V3V4 V5 1 01/01/1975 00:00:00 125.837 3.691 296.618 2 01/01/1975 01:00:00 124.799 3.679 281.307 3 01/01/1975 02:00:00 111.607 3.536 281.307 4 02/24/1976 11:00:00 21.602 2.555 93.893 5 02/