computeWindowVars: MAIN TITLE

View source: R/preprocessing.R

computeWindowVarsR Documentation

MAIN TITLE

Description

initial description

Usage

computeWindowVars(
  dat,
  vars = vars,
  nestVars = NULL,
  FUN = "mean",
  window = "All",
  timeVar = NULL,
  burnIn = 0,
  na.rm = F,
  onlyNewVarsOut = F,
  verbose = F,
  ...
)

Arguments

dat

a data.frame object

vars

a vector of variables names, corresponding to columns in the dat object for which the computation should be carried out

nestVars

either a character object or a vector of character objects with the column names in the dat object, indicating the nesting of the data (e.g., participant ID). Up to three nesting layers can be defined.

Value

a data frame with additional window variable(s)

Examples

 dat <- data.frame(ID = rep(1:2, each = 30), period  = rep(1:2, each = 15), a = runif(60, max = 10),
 b = Sys.Date()+1:60, cat = sample(c("A","B"), 60, replace = T))
 computeWindowVars(dat, vars = "a") # without nestVar
computeWindowVars(dat, vars = c("a"), nestVars = "ID")
computeWindowVars(dat, vars = c("a"), nestVars = c("ID","period", "cat"), burnIn = 1)
computeWindowVars(dat, vars = c("a"), nestVars = "ID", FUN = "sd")
computeWindowVars(dat, vars = c("a"), nestVars = "ID", FUN = "mean", window = 2, timeVar = "b")


timonelmer/dena documentation built on April 15, 2023, 11:51 p.m.