| prepare_SensIAT_data | R Documentation |
This function prepares the data for SensIAT analysis by transforming it into a format suitable for the SensIAT models.
prepare_SensIAT_data(
data,
id.var,
time.var,
outcome.var,
End,
add.terminal.observations = TRUE
)
data |
A data frame containing the data to be prepared. |
id.var |
The variable in |
time.var |
The variable in |
outcome.var |
The variable in |
End |
The end time for the analysis. Observations with time greater than |
add.terminal.observations |
Logical indicating whether to add terminal observations to the data ( |
A data frame with the following transformations:
Data filtered to time less than or equal to End.
Observations are arranged by id.var and time.var.
Terminal observations added if add.terminal.observations is TRUE,
with ..time.. set to End and ..outcome.. set to NA, if the
subject has less observations than the maximum number of observations.
New variables created:
..id.. aliases id.var,
..time.. aliases time.var,
..outcome.. aliases outcome.var,
..visit_number.. is the visit number within each subject derived from time.var,
..prev_outcome.., i.e. lag-outcome, the outcome from the previous visit,
..prev_time.., i.e. lag-time, the time from the previous visit,
..delta_time.., the difference in time between the current and previous visit.
prepare_SensIAT_data( SensIAT_example_data, Subject_ID, Time, Outcome, 830)
exdata <- tibble::tibble(ID=rep(1:2, c(3,5)),
Time=c(0, 30, 60,
0, 30, 60, 90, 120),
Outcome=floor(runif(8, 1, 100)))
prepare_SensIAT_data(exdata, ID, Time, Outcome, 120)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.