Learn R Programming

aba (version 0.0.9)

aba_demographics: Create a demographics table from a fitted aba model.

Description

This function allows you to automatically create a demographics table from a fitted aba model. The variables in the table will be inferred from the spec of the model (predictors, covariates, outcomes, etc.), although this can be customized.

Usage

aba_demographics(
  object,
  strata = NULL,
  include_predictors = TRUE,
  include_covariates = TRUE,
  include_outcomes = TRUE,
  add_vars = NULL,
  data_filter = NULL
)

Arguments

object

abaModel. The fitted aba model to create demographics table from.

strata

string (optional). How to stratify the demographics table.

include_predictors

boolean. Whether to include predictors in table.

include_covariates

boolean. Whether to include covariates in table.

include_outcomes

boolean. Whether to include outcomes in table.

add_vars

character vector (optional). Any additional variables to add to the demographics table. These variables should be present in the data from the aba model.

data_filter

logical expression (optional). If this is specified, the data from the aba model will be further filtered before the table is made.

Value

a TableOne object (see tableone package).

Details

Note that support is weaker for longitudinal data right now.

Examples

Run this code
# NOT RUN {
model <- aba_model() %>%
  set_data(adnimerge %>% dplyr::filter(VISCODE == 'bl')) %>%
  set_groups(everyone()) %>%
  set_outcomes(ConvertedToAlzheimers, CSF_ABETA_STATUS_bl) %>%
  set_predictors(
    PLASMA_PTAU181_bl, PLASMA_NFL_bl,
    c(PLASMA_PTAU181_bl, PLASMA_NFL_bl)
  ) %>%
  set_covariates(AGE, GENDER, EDUCATION) %>%
  set_stats('glm') %>%
  aba_fit()

my_table <- model %>% aba_demographics(strata = 'DX_bl')
print(my_table)

# }

Run the code above in your browser using DataLab