Description Usage Arguments Value Examples

Add multi-factorial data

1 2 | ```
addMultiFac(dtOld, nFactors, levels = 2, coding = "dummy",
colNames = NULL)
``` |

`dtOld` |
data.table that is to be modified |

`nFactors` |
Number of factors (columns) to generate. |

`levels` |
Vector or scalar. If a vector is specified, it must be the same length as nFatctors. Each value of the vector represents the number of levels of each corresponding factor. If a scalar is specified, each factor will have the same number of levels. The default is 2 levels for each factor. |

`coding` |
String value to specify if "dummy" or "effect" coding is used. Defaults to "dummy". |

`colNames` |
A vector of strings, with a length of nFactors. The strings represent the name for each factor. |

A data.table that contains the added simulated data. Each new column contains an integer.

1 2 3 4 5 6 7 8 9 10 | ```
defD <-defData(varname = "x", formula = 0, variance = 1)
DT <- genData(360, defD)
DT <- addMultiFac(DT, nFactors = 3, levels = c(2, 3, 3), colNames = c("A", "B", "C"))
DT
DT[, .N, keyby = .(A, B, C)]
DT <- genData(300, defD)
DT <- addMultiFac(DT, nFactors = 3, levels = 2)
DT[, .N, keyby = .(Var1, Var2, Var3)]
``` |

Embedding an R snippet on your website

Add the following code to your website.

For more information on customizing the embed code, read Embedding Snippets.