getTransformTS: Transform quantitative variables.

View source: R/shiny_modules_timeSeries.R

getTransformTSR Documentation

Transform quantitative variables.

Description

Transform quantitative variables. Aggregate or interpolate time series data.

Usage

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
)

Arguments

data

: data.frame to transform

col_date

: Date column name, default to "date". Must be "POSIXct"

col_series

: Column name of quantitative variable(s) to be transformed. Default to setdiff(colnames(data), "date")

col_by

: Column name of a optionnal grouping variable. Default to NULL

ts

: 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

tz

: Timezone of result. Defaut to "UTC".

fun_aggr

: Aggregation function to use ("min", "max", "sum", "mean", "first", "last", "maxabs", "minabs"). Default to "mean".

treat_missing

: Boolean. Default to FALSE Whether or not to interpolate missing values ? see na.approx

control_date

: Boolean. Control full data sequence ? Defaut to TRUE and set to TRUE if treat_missing

maxgap

: When interpolate missing values with na.approx. Maximum number of consecutive NAs to fill. Defaut to Inf.

keep_last

: Boolean. Keep last date/time value after interpolation ?

type_aggr

: 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

showwarn

: Boolean. Show warnings ?

na.rm

: aggregation only. a logical value indicating whether NA values should be stripped before the computation proceeds.

Value

a data.frame


rAmCharts documentation built on Sept. 30, 2022, 5:06 p.m.