Learn R Programming

simstudy (version 0.1.1)

genCluster: Simulate data set that is one level down in a multilevel data context. The level "2" data set must contain a field that specifies the number of individual records in a particular cluster.

Description

Simulate data set that is one level down in a multilevel data context. The level "2" data set must contain a field that specifies the number of individual records in a particular cluster.

Usage

genCluster(dtClust, cLevelVar, numIndsVar, level1ID, allLevel2 = TRUE)

Arguments

dtClust
Name of existing data set that contains the level "2" data
cLevelVar
Variable name (string) of cluster id in dtClust
numIndsVar
Variable name (string) of number of observations per cluster in dtClust
level1ID
Name of id field in new level "1" data set
allLevel2
Indicator: if set to TRUE (default), the returned data set includes all of the Level 2 data columns. If FALSE, the returned data set only includes the Levels 1 and 2 ids.

Value

A simulated data table with level "1" data