spells | R Documentation |
This function defines a magical (modified) formula
class that has been
vectorized. The spell
serves as a set of instructions or a script for the
formula and its runes. It expands upon the functionality of formulas,
allowing for additional descriptions and relationships to exist between the
runes.
sx( x = unspecified(), role = list(), tier = list(), label = list(), pattern = character(), ... ) cast_spell( x = unspecified(), role = list(), tier = list(), label = list(), pattern = character(), ... )
x |
Objects of the following types can be used as inputs
|
role |
Specific roles the variable plays within the formula. These are of particular importance, as they serve as special terms that can effect how a formula is interpreted. Please see the Roles section below for further details. The options for roles are as below:
|
tier |
Grouping variable names for covariates or confounders for modeling terms together |
label |
Display-quality label describing the variable |
pattern |
This is the expansion pattern used to decide how the
covariates will incorporated into the formulas. The options are
|
... |
Arguments to be passed to or from other methods |
An object of class spell
Specific roles the variable plays within the formula. These are of particular importance, as they serve as special runes that can effect how a formula is interpreted. The specialized options for roles are as below:
exposure or X(...)
outcome or O(...)
or placement of variable on LHS of formula
confounder or C(...)
mediator or M(...)
strata or S(...)
interaction or In()
Formulas can be condensed by applying their specific role to individual runes
as a function/wrapper. For example, y ~ X(x1) + x2 + x3
. This would signify
that x1
has the specific role of an exposure.
The expansion pattern allows for instructions on how the covariates should be included in different formulas. Below, assuming that x1, x2, and x3 are covariates...
y ~ x1 + x2 + x3
Direct:
y ~ x1 + x2 + x3
Seqential:
y ~ x1
y ~ x1 + x2
y ~ x1 + x2 + x3
Parallel:
y ~ x1
y ~ x2
y ~ x3
For the arguments that would be dispatched for objects that are plural,
e.g. containing multiple terms such as a formula
object, the input should
be wrapped within a list()
.
For example, for the role argument, it would be written:
role = list(X ~ "exposure", M ~ "mediator", C ~ "confounder")
This applies for all others plural objects and arguments.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.