tab1_re.Rd
tab1_re
takes lists of continuous and/or categorical variables and
returns Median (spread) for continuous variables and N (%) for categorical
variables. Produces a table with both an overall column and columns by
another variable. For a binary by variable only, it produces p-values from a
random effects model.
tab1_re(contvars, catvars, byvar, re, dat, col = TRUE, spread = "range")
contvars | is a list of the continuous variables you want in the rows e.g. list('Age'). Can be NULL. |
---|---|
catvars | is a list of the categorical variables you want in the rows e.g. list('Gender','Race'). Can be NULL. |
byvar | is the categorical variable you want to tabulate by across the
columns (needs to be in quotes). MUST BE 0/1 since it will be used as the
outcome variable in |
re | the name of the random effect variable, should be supplied in quotes, e.g. re = "ptid" |
dat | is the dataset to use for analysis |
col | takes the value TRUE or FALSE indicating whether you want column percent (TRUE, default) or row percent (FALSE) |
spread | takes the value "range" or "iqr" indicating whether you want (min, max) or (Q1, Q3) in summaries of continuous variables. Defaults to "range". |
Returns a dataframe. If there are warnings or errors from
glmer
then NA is returned in place of the p-value.