View source: R/ard_stats_mcnemar_test.R
ard_stats_mcnemar_test | R Documentation |
Analysis results data for McNemar's statistical test. We have two functions depending on the structure of the data.
ard_stats_mcnemar_test()
is the structure expected by stats::mcnemar.test()
ard_stats_mcnemar_test_long()
is one row per ID per group
ard_stats_mcnemar_test(data, by, variables, ...)
ard_stats_mcnemar_test_long(data, by, variables, id, ...)
data |
( |
by |
( |
variables |
( |
... |
arguments passed to |
id |
( |
For the ard_stats_mcnemar_test()
function, the data is expected to be one row per subject.
The data is passed as stats::mcnemar.test(x = data[[variable]], y = data[[by]], ...)
.
Please use table(x = data[[variable]], y = data[[by]])
to check the contingency table.
ARD data frame
cards::ADSL |>
ard_stats_mcnemar_test(by = "SEX", variables = "EFFFL")
set.seed(1234)
cards::ADSL[c("USUBJID", "TRT01P")] |>
dplyr::mutate(TYPE = "PLANNED") |>
dplyr::rename(TRT01 = TRT01P) %>%
dplyr::bind_rows(dplyr::mutate(., TYPE = "ACTUAL", TRT01 = sample(TRT01))) |>
ard_stats_mcnemar_test_long(
by = TYPE,
variable = TRT01,
id = USUBJID
)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.