parse_formula: Parse 'cmprsk2' formula

View source: R/formula.R

parse_formulaR Documentation

Parse cmprsk2 formula

Description

Parse crr2 or cuminc2 formulas into usefule pieces and optionally check data source for errors.

Usage

parse_formula(formula, data = NULL, name = NULL)

Arguments

formula

a valid crr2 or cuminc2 formula

data, name

optional data frame and data name to check variables from formula

Value

A list with the following elements:

formula

the unchanged formula coerced to a formula object

lhs_vars

all variable names found on the left-hand side of formula

rhs_vars

all variable names found on the right-hand side of formula with any factor(), strata(), etc. modifications removed

lhs

the left-hand side of formula as it appears

rhs

the right-hand side of formula as it appears with any factor(), strata(), etc. included

ftime

variable in data defining times

fstatus

variable in data defining censoring and failure events

cencode

censor code, a value of data$fstatus

failcode

failure code of interest if given, a value of [data$fstatus] (required for a crr2 model but optional for cuminc2)

cov1

cov1 variable names to be evaluated by model.matrix as they appear

cov2

cov2 variable names (functions of time) to be evaluated by model.matrix as they appear

strata

strata variable names


raredd/cmprsk2 documentation built on March 29, 2024, 5:34 a.m.