| DataStandard | R Documentation |
Converts supported binary values to 0 and 1, replaces subject IDs and
analysis times with consecutive integers, sorts the data by subject and time,
and stores the information needed by other PDRobust functions.
DataStandard(data, mapping, drop = FALSE)
data |
A long-format data frame. |
mapping |
A |
drop |
If |
A data frame inheriting from pd_data, retaining the input column
names and additional unmapped columns. Rows outside the mapped time window
are removed; retained rows are sorted by recoded ID and time. Attributes are:
The mapping updated to use the standardized baseline and cutoff times. Column names remain unchanged.
The mapping supplied for the raw data.
The final pd_data_check report, including attrition.
A warning is issued if the returned data are not ready for analysis,
for example if deletion removes one treatment group.
A list containing time_map, id_map,
attrition, and initial_check. The maps link raw values to their
standardized values; the initial check describes the input data.
The function checks the data both before and after preparation. The stored reports describe this call and are not recalculated if the returned data are later edited or subsetted; see pd_methods. The ID map has one row per retained subject, so its size increases with the number of subjects. Analysis values retain full precision; only summaries shown to users and percentages describing removed data are rounded.
data("BiSample", package = "PDRobust")
map <- Mapping(
id = "id", time = "time", treatment = "A",
survival = "S", outcome = "Y",
baseline_time = 0, cutoff_time = 2,
covariates = c("X1", "X2", "X4"),
interest_vars = c("X1", "X2"), y_type = "B"
)
pd_dat <- DataStandard(BiSample, map)
attr(pd_dat, "pd_mapping")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.