hce {hce} | R Documentation |
Helper function for hce
objects
Description
Helper function for hce
objects
Usage
hce(
GROUP = character(),
TRTP = character(),
AVAL0 = 0,
ORD = sort(unique(GROUP))
)
Arguments
GROUP |
a character vector of the same length as |
TRTP |
a character vector of the same length as |
AVAL0 |
a numeric vector of analysis values within each category. The default is 0. |
ORD |
a character vector containing ordered unique values of the |
Value
an object of class hce
. Its is a subject-level data frame (each row corresponds to one subject), containing the following columns:
SUBJID subject ID.
GROUP a character vector specifying the type of the outcome the patient experienced - either a TTE (time-to-event) or C (continuous).
GROUPN a numeric vector version of the
GROUP
column.AVAL0 original analysis values - time of the time-to-event outcomes or the continuous outcome.
AVAL derived analysis value
AVAL = AVAL0 + GROUPN
.TRTP assigned treatment groups.
See Also
as_hce()
for coercing to hce
objects.
Examples
# Example 1
set.seed(2022)
d <- hce(GROUP = sample(x = c("A", "B", "C"), size = 10, replace = TRUE),
TRTP = rep(c("Active", "Control"), each = 5),
AVAL0 = c(rnorm(5, mean = 1), rnorm(5)), ORD = c("A", "B", "C"))
calcWO(d, ref = "Control")