Skip to contents

[Superseded]

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. We recommend moving to dsTidyverseClient::ds.mutate() which is quicker, although would require a few more lines of code.

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.makeIQR(), dh.quartileSplit(), dh.zByGroup()