View source: R/brm_data_change.R
brm_data_change | R Documentation |
Convert a dataset from raw response to change from baseline.
brm_data_change(data, name_change = "change", name_baseline = "baseline")
data |
A classed |
name_change |
Character of length 1, name of the new outcome column for change from baseline. |
name_baseline |
Character of length 1, name of the new column for the original baseline response. |
A classed tibble
with change from baseline as the outcome variable
and the internal attributes modified accordingly. A special baseline
column is also created, and the original raw response column is removed.
The new baseline column is comprised of the elements of the response
variable corresponding to the reference_time
argument of brm_data()
.
If there is a column to denote missing values for simulation purposes,
e.g. the "missing"
column generated by brm_simulate_outline()
,
then missing baseline values are propagated accordingly such that
change from baseline will be missing if either the post-baseline response
is missing or the baseline response is missing.
Other data:
brm_data()
,
brm_data_chronologize()
set.seed(0)
data <- brm_data(
data = dplyr::rename(brm_simulate_simple()$data, y_values = response),
outcome = "y_values",
group = "group",
time = "time",
patient = "patient",
reference_group = "group_1",
reference_time = "time_1"
)
data
attr(data, "brm_outcome")
attr(data, "brm_baseline")
attr(data, "brm_reference_time")
changed <- brm_data_change(data = data, name_change = "delta")
changed
attr(changed, "brm_outcome")
attr(changed, "brm_baseline")
attr(data, "brm_reference_time")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.