[R] cumsum on chron objects

Sebastian Luque sluque at mun.ca
Wed May 18 00:49:18 CEST 2005


Is there some alternative to cumsum for chron objects? I have data frames
that contain some chron objects that look like this:

13/10/03 12:30:35
15/10/03 16:30:05

and I've been trying to replace the NA's so that a date/time sequence is
created starting with the preceding available value. Because the number of
rows with NA's following each available date/time is unknown, I've split
the data frame using:

splitdf <- split(df, as.factor(df$DateTime))

so that I can later use lapply to work on each "block" of data. I thought
I could use cumsum and set the NA's to the desired interval to create the
date/time sequence starting with the first row. However, this function is
not defined for chron objects. Does anybody know of alternatives to create
such a sequence?

Thanks in advance,
Sebastian P. Luque

More information about the R-help mailing list