'How to create factorial designs in R?

I am trying to create a shiny app for the conjoint analysis. Once I have entered the number and names of all the levels and attributes I should create a fractional or orthogonal factorial design (both are fine for me)

I saved values ​​like this:

 values <- shiny::reactiveValues() 

With the following names I have saved these elements:

Number of attributes: values$nats

Number of levels: values$levels

Attribute names: values$atnames

Levels names: values$levnames

The code i tried is the following but it doesn't work:

library(DoE.base)
.....
factor.names<-list()
for (i in seq_len(values_nats)){
  for (t in seq_len(values$levels)){
    factor.names <- list(factor.names, values$levname[t])
  }
}
oa.design(factor.names=factor.names)

Does anyone know how to create factorial designs?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source