Transform quantitative variables. Aggregate or interpolate time series data.
getTransformTS(
data,
col_date = "date",
col_series = setdiff(colnames(data), c(col_date, col_by)),
col_by = NULL,
ts = "10 min",
tz = "UTC",
fun_aggr = "mean",
treat_missing = FALSE,
control_date = TRUE,
maxgap = Inf,
keep_last = TRUE,
type_aggr = "first",
showwarn = FALSE,
na.rm = TRUE
)
a data.frame
: data.frame to transform
: Date column name, default to "date". Must be "POSIXct"
: Column name of quantitative variable(s) to be transformed. Default to setdiff(colnames(data), "date")
: Column name of a optionnal grouping variable. Default to NULL
: Increment of the sequence. Default to "10 min". Can be a number, in seconds, or a character string containing one of "min", "hour", "day". This can optionally be preceded by a positive integer and a space
: Timezone of result. Defaut to "UTC".
: Aggregation function to use ("min", "max", "sum", "mean", "first", "last", "maxabs", "minabs"). Default to "mean".
: Boolean. Default to FALSE
Whether or not to interpolate missing values ?
see na.approx
: Boolean. Control full data sequence ? Defaut to TRUE and set to TRUE if treat_missing
: When interpolate missing values with na.approx
.
Maximum number of consecutive NAs to fill. Defaut to Inf.
: Boolean. Keep last date/time value after interpolation ?
: Character. Type of aggregation
"first" : Date/Time result is equal to minimum of sequence, and this minimum is included in aggregation
"last" : Date/Time result is equal to maximum of sequence, and this maximum is included in aggregation
: Boolean. Show warnings ?
: aggregation only. a logical value indicating whether NA values should be stripped before the computation proceeds.