View source: R/downsample_time_series_2.R
downsample_time_series_2 | R Documentation |
This function will resample time series data ( downsample) to the nearest minute, half-hour, hour, or day. It allow to summarise the measurement values using mean, median, or sum.
downsample_time_series(data = NULL, datetime_column = "datetime",amount = 30,
units = c("minute", "hour", "day", "week"), method = c("mean", "sum", "median"))
data |
data frame or tibble with 2 columns. One column must be a POSIXct object. |
amount |
the amount of units to downsample for |
units |
a character object like:"hour", "minute", "day", "week". Default is "minute" |
method |
methods by which to summarise the measurement values in the timeseries: "mean", "sum", "median". Default is "mean". |
datetime_column |
column in data that has the datetime |
A data.frame with 2 columns: downsampled_data: summarise measurement values floored_dates: downsampled POSIXct object
df_downsampled <- downsample_time_series(data = raw_data,
datetime_column = "datetime", amount = 30, units = "hour", method = "sum")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.