createFormulaList: Create a list of formulas

Description Usage Arguments Details Value Author(s) Examples

Description

createFormulaList returns a list of formulas with all combinations of dependent and independent variables.

Usage

1
createFormulaList(dependent, independent, covariates, interactions = NULL)

Arguments

dependent

A single or a vector of variables names that the user wishes to use as dependent variables in an analysis; dependent must be as a string/character.

independent

Similar to dependent, except that the variables would be the independent, or exposure, variables of interest.

covariates

Confounders or covariates that would be included in all formulas and hence all models. Also must be a string/character.

interactions

Optional, include one variable from the covariates set that will be assigned as an interaction term with the independent variable. Must be a string/character.

Details

This function creates a list of formulas for use in a chain of processes. This function's goal is to create all combinations of a set of dependent, or outcome, variables with a set of independent, or exposure variables. Covariates and an interaction term can also be specified and included into the formula.

Value

Outputs a list of formulas.

Author(s)

Luke W. Johnston

Examples

1
2
3
4
5
6
7
outcomes <- c('Income', 'Education', 'Job')
exposures <- c('Age', 'Sex', 'Height', 'Race', 'IQ')
covariates <- c('ParentEdu', 'Country', 'City')
interactions <- 'City'

createFormulaList(outcomes, exposures, covariates)
createFormulaList(outcomes, exposures, covariates, interactions)

lwjohnst86/rstatsToolkit documentation built on May 21, 2019, 9:15 a.m.