formulasFrame: Model frames for multiple formulas

Description Usage Arguments Value Note See Also Examples

Description

Constructs model frames for multiple formulas simultaneously, so that recycling, missing value removal, and subsetting are compatible across all formulas.

Usage

1
2
3
formulasFrame(formulas, data = parent.frame(), na.action =
getOption("na.action"), subset = NULL, weights = NULL check.env = FALSE,
one.frame = TRUE)

Arguments

formulas

A list of formulas

data

A data frame to look up variables

na.action

Name of an na.action function

subset

Subset to use

weights

Optional vector specifying weights to use.

check.env

If TRUE, warn when formulas don't have the same environment

one.frame

If TRUE, return a single data frame, otherwise return a list of data frames

Value

A data frame or list of data frames.

Note

This function is designed to simplify the avoidance of scoping anomalies in modelling functions, by allowing all the variables that are looked up in a data argument to be specified as formulas.

The code and documentation of this function are used with only minor modifications from the one available at the R Developer page - http://developer.r-project.org/.

See Also

model.frame

Examples

1
2
3
4
5
  data(trees)
  trees[3,3]<-NA
  formulasFrame(list(log(Volume)~log(Height)+log(Girth),~Girth), subset=1:10, data=trees)

  formulasFrame(list(log(Volume)~log(Height)+log(Girth),~Girth), data=trees,subset=1:10, one.frame=FALSE)

jrnold/r-strat documentation built on May 20, 2019, 1:05 a.m.