Learn R Programming

subformula (version 0.1.0)

fapply: Apply Formulas to a Model

Description

fapply returns a list of the same length as formulas. Each element is the result of applying modelthe the corresponding element of formulas.

Usage

fapply(formulas, model, ...)

Arguments

formulas

a list of formulas or objects coercible to formula by stats::as.formula.

model

a function taking a formula as its first argument.

...

additional arguments to be passed to model.

Value

fapply returns a list of evaluated function calls.

Details

This is a member of the apply family. It is similar to lapply, but handles the call slightly differently. This makes the output prettier.

Examples

Run this code
# NOT RUN {
formulas = subformula(mpg ~ cyl + disp, protected = ~ cyl)
fapply(formulas, lm, data = mtcars) # Pretty output.
lapply(formulas, lm, data = mtcars) # Less pretty output.
# }

Run the code above in your browser using DataLab