model.data {rsm} | R Documentation |
Create a data frame with just the variables in the formula in
a lm
object.
This is comparable to model.matrix
or model.frame
except that factors,
polynomials, transformations, etc. are not expanded.
model.data(lmobj, lhs = FALSE)
lmobj |
An object returned by lm or one of its relatives. |
lhs |
Boolean indicator of whether or not to include the variable(s) on the left-hand side of the model formula. |
This is an easy-to-use substitute for get_all_vars
.
The formula
, data
, and subset
arguments, if present in
lmobj
's call, affect the result appropriately.
A data frame containing each of the variables referenced in the model formula.
Russell V. Lenth
library(rsm) trees.lm = lm(log(Volume) ~ poly(log(Girth),3), data=trees, subset=1:20) model.frame(trees.lm) model.data(trees.lm)