Greetings -- I have a dataframe a with one element a vector, time, of
POSIXct values. What's a good way to split the data frame into
periods of a$time, e.g. days, and apply a function, e.g. mean, to some
other column of the dataframe, e.g. a$value?
Cheers,
Alexy
?aggregate
?window.zoo
?rollapply
anyway have a look at package zoo
On Tue, Sep 9, 2008 at 3:25 PM, Alexy Khrabrov [EMAIL PROTECTED] wrote:
Greetings -- I have a dataframe a with one element a vector, time, of
POSIXct values. What's a good way to split the data frame into periods of
a$time,
Here is one way of doing it:
x - data.frame(dates=seq(as.POSIXct('2008-09-08'), by='7 hours', length=10),
+ values=1:10)
# split into days
x.s - split(x, format(x$dates, %Y%m%d))
x.s
$`20080908`
dates values
1 2008-09-08 00:00:00 1
2 2008-09-08 07:00:00 2
3
3 matches
Mail list logo