Re-code the levels in a design of experiment

recodeDoe(doe, levels)

Arguments

doe

A design of experiment data frame. Each row is an alternative, each column is an attribute.

levels

A named list of vectors defining each attribute (the names) and each level for each attribute (the vectors). For example, a design with two attributes, "price" and "type", that each had three levels should be defined as levels = list(price = c(1, 2, 3), type = c(1, 2, 3)).

Value

Returns a re-coded design of experiment using the labels in the levels argument.

Examples

# Define the attributes and levels
levels <- list(
  price     = seq(1, 4, 0.5), # $ per pound
  type      = c('Fuji', 'Gala', 'Honeycrisp', 'Pink Lady', 'Red Delicious'),
  freshness = c('Excellent', 'Average', 'Poor')
)

# Make a full-factorial design of experiment
doe <- makeDoe(levels)

# Re-code levels
doe <- recodeDoe(doe, levels)