ard_ttest | R Documentation |
Analysis results data for paired and non-paired t-tests.
ard_ttest(data, by, variable, ...)
ard_paired_ttest(data, by, variable, id, ...)
data |
( |
by |
( |
variable |
( |
... |
arguments passed to |
id |
( |
For the ard_ttest()
function, the data is expected to be one row per subject.
The data is passed as t.test(data[[variable]] ~ data[[by]], paired = FALSE, ...)
.
For the ard_paired_ttest()
function, the data is expected to be one row
per subject per by level. Before the t-test is calculated, the data are
reshaped to a wide format to be one row per subject.
The data are then passed as
t.test(x = data_wide[[<by level 1>]], y = data_wide[[<by level 2>]], paired = TRUE, ...)
.
ARD data frame
cards::ADSL |>
dplyr::filter(ARM %in% c("Placebo", "Xanomeline High Dose")) |>
ard_ttest(by = ARM, variable = AGE)
# constructing a paired data set,
# where patients receive both treatments
cards::ADSL[c("ARM", "AGE")] |>
dplyr::filter(ARM %in% c("Placebo", "Xanomeline High Dose")) |>
dplyr::mutate(.by = ARM, USUBJID = dplyr::row_number()) |>
dplyr::arrange(USUBJID, ARM) |>
ard_paired_ttest(by = ARM, variable = AGE, id = USUBJID)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.