CMData {CorrBin} | R Documentation |
Create a ‘CMdata’ object from a data frame.
Description
The CMData
function creates an object of class CMData that is
used in further analyses. It identifies the variables that define treatment
group, clustersize and the number of responses for each outcome type.
Usage
CMData(x, trt, nresp, clustersize = NULL, 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 for each outcome |
trt |
the name of the variable that defines treatment group |
nresp |
either a character vector with the names or a numeric vector with indices
of the variables that define the number of responses in
the cluster for each outcome type. If |
clustersize |
the name or index of the variable that defines cluster size, or |
freq |
the name or index of the variable that defines the number of clusters
represented by the data row. If |
Value
A data frame with each row representing all the clusters with the same trt/size/number of responses, and standardized variable names:
Trt |
factor, the treatment group |
ClusterSize |
numeric, the cluster size |
NResp.1--NResp.K+1 |
numeric, the number of responses for each of the K+1 outcome types |
Freq |
numeric, number of clusters with the same values |
Author(s)
Aniko Szabo
See Also
read.CMData
for creating a CMData
object
directly from a file.
Examples
data(dehp)
dehp <- CMData(dehp, trt="Trt", nresp=c("NResp.1","NResp.2","NResp.3"))
str(dehp)