eventSeries | R Documentation |
Some time-series analyses require data that are uniformly spaced in time. This function will construct a regular series from randomly spaced events.
eventSeries(times, period = "hour", which = "cumsum", begin, end, k.period = 1)
times |
a date-like vector corresponding to data. |
period |
character string that is valid input to the POSIXct method
for the |
which |
a character string indicating the method to use. See Details for options. |
begin |
the beginning date as POSIXt or as character. |
end |
the end date as POSIXt or as character. |
k.period |
the number of units of |
If there is no observation during a period, then that value
is set to 0 if which
is "sum" or the value for the previous period if
which
is "cumsum." The initial value of the series is always 0.
The function eventSeries
returns a data frame with two columns:
DateTime |
the date and time. |
Sum |
the sum of the number of events in the period if |
CumSum |
the cumulative sum of the number of events up to and
including the period if |
## Not run: library(smwrData) data(QW05078470) # Count the number of samples per month with(QW05078470, eventSeries(DATES, "month", which="sum")) ## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.