genMultiFac: Generate multi-factorial data

Description Usage Arguments Value Examples

View source: R/genMultiFac.R

Description

Generate multi-factorial data

Usage

1
2
genMultiFac(nFactors, each, levels = 2, coding = "dummy",
  colNames = NULL, idName = "id")

Arguments

nFactors

Number of factors (columns) to generate.

each

Number of replications for each combination of factors. Must be specified.

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.

idName

A string that specifies the id of the record. Defaults to "id".

Value

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

Examples

1
2
3
4
genMultiFac(nFactors = 2, each = 5)
genMultiFac(nFactors = 2, each = 4, levels = c(2, 3))
genMultiFac(nFactors = 3, each = 1, coding = "effect", 
   colNames = c("Fac1","Fac2", "Fac3"), id = "block")

kgoldfeld/simstudy documentation built on Nov. 8, 2018, 7:41 p.m.