Learn R Programming

Boom (version 0.9.15)

GenerateFactorData: Generate a data frame of all factor data

Description

This function is mainly intended for example code and unit testing. It generates a data.frame containing all factor data.

Usage

GenerateFactorData(factor.levels.list, sample.size)

Arguments

factor.levels.list

A list of character vectors giving factor level names. The names attribute of this list becomes the set of variables names for the return data frame.

sample.size

The desired number of rows in the returned data frame.

Author

Steven L. Scott steve.the.bayesian@gmail.com

Examples

Run this code
  foo <- GenerateFactorData(list(a = c("foo", "bar", "baz"),
                                 b = c("larry", "moe", "curly", "shemp")),
                            50)

  head(foo)
#     a     b
# 1 bar curly
# 2 foo curly
# 3 bar   moe
# 4 bar   moe
# 5 baz curly
# 6 bar curly

Run the code above in your browser using DataLab