time_pad | R Documentation |
time_pad
use is similar to openair's timeAverage
, but
the aggregation of values does not occur. time_pad
does not drop
non-numerical variables, can include identifiers post-pad, and can start and
end a padded time-series at a "nice place", for example, at the beginning of
an hour or day.
time_pad(
df,
interval = "hour",
by = NA,
round = NA,
full = FALSE,
uniform_padding = FALSE,
warn = TRUE
)
df |
A tibble/data frame including parsed dates. The date
variable/column must be named |
interval |
Interval of returned time series. Some examples could be:
|
by |
Should |
round |
What date-unit should the first and last observations be rounded
to? This allows the padded time-series to begin and end at a "nice place".
Examples are |
full |
Should the date joining use the |
uniform_padding |
If a |
warn |
Should the function give a warning when dates are duplicated?
Default is |
time_pad
pads a time series by calculating the maximum and minimum
dates within a time series and then generating a uniform date sequence
between the maximum and minimum dates. This date sequence is then joined to
the input data frame and the missing values are represented as NA
.
Tibble.
Stuart K. Grange
See round_date_interval
, timeAverage
,
round_date
, left_join
,
aggregate_by_date
## Not run:
# Pad time series so every minute is present
data_nelson_pad <- time_pad(data_nelson, interval = "min", round = "day")
# Keep identifying variables "site" and "sensor"
data_ozone_sensor_pad <- time_pad(
data_ozone_sensor,
interval = "hour",
by = c("site", "sensor")
)
## End(Not run)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.