Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

build_datalist

Build list of data.frames


Description

Construct a list of data.frames based upon an input data.frame and a list of one or more at values

Usage

build_datalist(data, at = NULL, as.data.frame = FALSE, ...)

Arguments

data

A data.frame containing the original data.

at

A list of one or more named vectors of values, which will be used to specify values of variables in data. All possible combinations are generated. Alternatively, this can be a data frame of combination levels if only a subset of combinations are desired. See examples.

as.data.frame

A logical indicating whether to return a single stacked data frame rather than a list of data frames

...

Ignored.

Value

A list of data.frames, unless as.data.frame = TRUE in which case a single, stacked data frame is returned.

Author(s)

Thomas J. Leeper

See Also

Examples

# basic examples
require("datasets")
build_datalist(head(mtcars), at = list(cyl = c(4, 6)))

str(build_datalist(head(mtcars), at = list(cyl = c(4,6), wt = c(2.75,3,3.25))), 1)

str(build_datalist(head(mtcars), at = data.frame(cyl = c(4,4), wt = c(2.75,3))))

prediction

Tidy, Type-Safe 'prediction()' Methods

v0.3.14
MIT + file LICENSE
Authors
Thomas J. Leeper [aut, cre] (<https://orcid.org/0000-0003-4097-6326>), Carl Ganz [ctb], Vincent Arel-Bundock [ctb] (<https://orcid.org/0000-0003-2042-7063>)
Initial release
2019-06-16

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.