dh.makeAgePolys: Produces multiple transformations of the age term for...

View source: R/make-age-polys.R

dh.makeAgePolysR Documentation

Produces multiple transformations of the age term for fractional polynomial analyses

Description

When we do trajectory analyses using fractional polynomials we often want to try models with different combinations of age polynomials. This function creates multiple transformations of an age variable to different powers.

Usage

dh.makeAgePolys(
  df = NULL,
  age_var = NULL,
  poly_form = c("^-2", "^-1", "^-0.5", "log", "^0.5", "^2", "^3"),
  poly_names = c("_m_2", "_m_1", "_m_0_5", "log", "_0_5", "_2", "_3"),
  conns = NULL,
  checks = TRUE,
  agevars = NULL
)

Arguments

df

Character specifying a server-side data frame.

age_var

Character specifying age variable within 'df' to transform.

poly_form

Character vector of powers by which to transform 'age_var'.

poly_names

Character vector of names for the created variables. Must the same length and order as 'poly_form'.

conns

DataSHIELD connections object.

checks

Logical; if TRUE checks are performed prior to running the function. Default is TRUE.

agevars

Retired argument name. Please use ‘age_var’ instead.

Value

Transformations of age are added as columns to server-side object specified in 'df'.

See Also

Other trajectory functions: dh.lmeMultPoly(), dh.makeLmerForm(), dh.predictLmer(), dh.trimPredData(), dh.zByGroup()

Other data manipulation functions: dh.dropCols(), dh.makeIQR(), dh.makeStrata(), dh.quartileSplit(), dh.renameVars(), dh.tidyEnv(), dh.zByGroup()


lifecycle-project/ds-helper documentation built on Oct. 27, 2023, 2:08 p.m.