View source: R/make-age-polys.R
dh.makeAgePolys | R Documentation |
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.
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
)
df |
Character specifying a server-side data frame. |
age_var |
Character specifying age variable within |
poly_form |
Character vector of powers by which to transform |
poly_names |
Character vector of names for the created variables. Must
the same length and order as |
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. |
Transformations of age are added as columns to server-side object
specified in df
.
Other trajectory functions:
dh.lmeMultPoly()
,
dh.makeLmerForm()
,
dh.predictLmer()
,
dh.trimPredData()
,
dh.zByGroup()
Other data manipulation functions:
dh.makeIQR()
,
dh.quartileSplit()
,
dh.zByGroup()
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.