# NOT RUN {
# ------------------------ association tests -----------------------------
set.seed(123)
# without counts data
ggstatsplot::subtitle_contingency_tab(
data = mtcars,
main = am,
condition = cyl,
nboot = 15
)
# with counts data
# in case of no variation, a `NULL` will be returned.
library(jmv)
as.data.frame(HairEyeColor) %>%
dplyr::filter(.data = ., Sex == "Male") %>%
subtitle_contingency_tab(
data = .,
main = Hair,
condition = Sex,
counts = Freq
)
# ------------------------ goodness of fit tests ---------------------------
# for reproducibility
set.seed(123)
# with counts
subtitle_contingency_tab(
data = as.data.frame(HairEyeColor),
main = Eye,
counts = Freq,
ratio = c(0.2, 0.2, 0.3, 0.3)
)
# in case of no variation, only sample size will be shown
subtitle_contingency_tab(
data = cbind.data.frame(x = rep("a", 10)),
main = x
)
# }
Run the code above in your browser using DataLab