formatRCTDataset {aVirtualTwins} | R Documentation |
RCT format for Virtual Twins
Description
formatRCTDataset
returns dataset that Virtual Twins is able to
analyze.
Usage
formatRCTDataset(dataset, outcome.field, treatment.field, interactions = TRUE)
Arguments
dataset |
data.frame representing RCT's |
outcome.field |
name of the outcome's field in |
treatment.field |
name of the treatment's field in |
interactions |
logical. If running VirtualTwins with treatment's interactions, set to TRUE (default value) |
Details
This function check these differents topic: Outcome must be binary and a
factor. If numeric with two distincts values, outcome becomes a factor where
the favorable reponse is the second level. Also, outcome is moved on the
first column of dataset
.
Treatment must have two distinct numeric values, 0 : no treatment, 1 : treatment. Treatment is moved to the second column.
Qualitatives variables must be factor. If it has more than two levels, if running VirtualTwins with interaction, it creates dummy variables.
Value
return data.frame with good format (explained in details section) to run VirtualTwins
Examples
## Not run:
data.format <- formatRCTDataset(data, "outcome", "treatment", TRUE)
## End(Not run)
data(sepsis)
data.format <- formatRCTDataset(sepsis, "survival", "THERAPY", T)