many_lm {lmhelprs} | R Documentation |
Fit Linear Models Defined By Model Syntax
Description
Fit a list of linear models defined by model syntax.
Usage
many_lm(models, data, na_omit_all = TRUE, ...)
Arguments
models |
Character. Model syntax. See Details. |
data |
The data frame. Must be
supplied if |
na_omit_all |
How missing data
is handled across models. If |
... |
Additional arguments. To
be passed to |
Details
This function extracts
linear model formulas from a
model syntax (a character vector),
fits each of them by lm()
, and
stores the results in a list.
Lines with the first non-whitespace
character "#"
are treated as comments
and ignored.
Each line must be a valid formula
for lm()
.
Value
A list of the output of lm()
. The
class is lm_list_lmhelprs
.
Author(s)
Shu Fai Cheung https://orcid.org/0000-0002-9871-9448
See Also
Examples
data(data_test1)
mod <- "x3 ~ x2 + x1
x4 ~ x3
x5 ~ x4*x1"
out <- many_lm(mod, data_test1)
summary(out)