Learn R Programming

CorrBin (version 1.4)

CBData: Create a `CBdata' object from a data frame.

Description

The CBData function creates an object of class CBData that is used in further analyses. It identifies the variables that define treatment group, clustersize and the number of responses.

Usage

CBData(x, trt, clustersize, nresp, freq = NULL)

Arguments

x
a data frame with one row representing a cluster or potentially a set of clusters of the same size and number of responses
trt
the name of the variable that defines treatment group
clustersize
the name of the variable that defines cluster size
nresp
the name of the variable that defines the number of responses in the cluster
freq
the name of the variable that defines the number of clusters represented by the data row. If NULL, then each row is assumed to correspond to one cluster.

Value

  • A data frame with each row representing all the clusters with the same trt/size/number of responses, and standardized variable names:
  • Trtfactor, the treatment group
  • ClusterSizenumeric, the cluster size
  • NRespnumeric, the number of responses
  • Freqnumeric, number of clusters with the same values

See Also

read.CBData for creating a CBData object directly from a file.

Examples

Run this code
data(shelltox)
sh <- CBData(shelltox, trt="Trt", clustersize="ClusterSize", nresp="NResp")
str(sh)

Run the code above in your browser using DataLab