unwrap: Unwrap a clustered object

Description Usage Arguments Value Author(s) Examples

View source: R/aaa-generics.R

Description

unwrap is a utility function that reformats a CBData or 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

1
2
3
4
5
6
7
## S3 method for class 'CBData'
unwrap(object, ...)

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

unwrap(object, ...)

Arguments

object

a CBData object

...

other potential arguments; not currently used

Value

For unwrap.CMData: a data frame with one row for each cluster element (having a multinomial outcome) with the following standardized column names

Trt

factor, the treatment group

ClusterSize

numeric, the cluster size

ID

factor, each level representing a different cluster

Resp

numeric with integer values giving the response type of the cluster element

For unwrap.CBData: a data frame with one row for each cluster element (having a binary outcome) with the following standardized column names

Trt

factor, the treatment group

ClusterSize

numeric, the cluster size

ID

factor, each level representing a different cluster

Resp

numeric with 0/1 values, giving the response of the cluster element

Author(s)

Aniko Szabo

Examples

1
2
3
4
5
6
7
8
data(dehp)
dehp.long <- unwrap(dehp)
head(dehp.long)


data(shelltox)
ush <- unwrap(shelltox)
head(ush)

CorrBin documentation built on May 2, 2019, 4:46 p.m.