Learn R Programming

CorrBin (version 1.4)

unwrap: Unwrap a clustered object

Description

unwrap.CBData is a utility function that reformats a CBData object so that each row is one observation (instead of one or more clusters). A new `ID' variable is added to indicate clusters. This form can be useful for setting up the data for a different package. unwrap.CMData is a utility function that reformats a CMData object so that each row is one observation (instead of one or more clusters). A new `ID' variable is added to indicate clusters. This form can be useful for setting up the data for a different package.

Usage

unwrap(object, ...)

## S3 method for class 'CBData':
unwrap(object, ...)

## S3 method for class 'CMData':
unwrap(object, ...)

Arguments

object
a CBData object
...
other potential arguments; not currently used

Value

  • For uwrap.CBData: a data frame with one row for each cluster element (having a binary outcome) with the following standardized column names
  • Trtfactor, the treatment group
  • ClusterSizenumeric, the cluster size
  • IDfactor, each level representing a different cluster
  • Respnumeric with 0/1 values, giving the response of the cluster element
  • For unwrap.CMData: a data frame with one row for each cluster element (having a multinomial outcome) with the following standardized column names
  • Trtfactor, the treatment group
  • ClusterSizenumeric, the cluster size
  • IDfactor, each level representing a different cluster
  • Respnumeric with integer values giving the response type of the cluster element

Examples

Run this code
data(shelltox)
ush <- unwrap(shelltox)
head(ush)
data(dehp)
dehp.long <- unwrap(dehp)
head(dehp.long)

Run the code above in your browser using DataLab