x <- data.frame(
a = 1:10,
b = rnorm(10)
)
assert_df_with_variables(x, variables = list(a = "a", b = "b"))
x <- ex_adsl
assert_df_with_variables(x, list(a = "ARM", b = "USUBJID"))
x <- ex_adsl
assert_df_with_factors(x, list(a = "ARM"))
assert_proportion_value(0.95)
assert_proportion_value(1.0, include_boundaries = TRUE)
rsp <- c(TRUE, TRUE, FALSE, TRUE, FALSE, FALSE)
grp <- factor(c(rep("Placebo", 3), rep("X", 3)))
strata <- factor(c("A", "A", "B", "A", "B", "B"))
assert_proportion_data(rsp, grp, strata)
if (FALSE) {
# An error is raised when `grp` has only one level.
grp <- factor(rep("X", 6))
assert_proportion_data(rsp, grp, strata)
}
Run the code above in your browser using DataLab