Hi R-help,

I have a dataframe consisting of a time-series [t, v]. The timestamps aren't
at all evenly spaced. The values are continuous. I've been able to graph
this as a step function (which is what it should be) in ggplot2, using the
'step' geom. Now I would like to take the integral of the step function.

For this and other reasons, is there a way to convert this into an evenly
time-interval-ed array?


example current dataframe:

t(currently as.POSIXct-ed)             value
5/31/11 0:00                                  7.56
5/31/11 0:01                                  7.78
5/31/11 1:05                                  3.00
5/31/11 1:17                                  8.32


desired (something like this, anyway):
t                                                  value
5/31/11 0:00                                 7.56
5/31/11 0:05                                 7.78
5/31/11 0:10                                 7.78
...                                                ...
5/31/11 1:00                                 7.78
5/31/11 1:05                                 3.00
5/31/11 1:10                                 3.00
5/31/11 1:15                                 3.00
5/31/11 1:20                                 8.32

It could also be factors like: 0:00 - 0:05, 7.56. However I don't think my
grasp of this is very good. It'd also be great if the solution were general
purpose so that I can change the parameters as needed (like interval size).

I've been banging my head on #R and begun reading plyr/reshape
documentation, so I would really appreciate any help!

-Derrick

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to