Learn R Programming

lava (version 1.8.0)

Expand: Create a Data Frame from All Combinations of Factors

Description

Create a Data Frame from All Combinations of Factors

Usage

Expand(`_data`, ...)

Arguments

_data

Data.frame

...

vectors, factors or a list containing these

Author

Klaus K. Holst

Details

Simple wrapper of the 'expand.grid' function. If x is a table then a data frame is returned with one row pr individual observation.

Examples

Run this code
dd <- Expand(iris, Sepal.Length=2:8, Species=c("virginica","setosa"))
summary(dd)

T <- with(warpbreaks, table(wool, tension))
Expand(T)

Run the code above in your browser using DataLab