From 60273aefa98cb54f145ddcacb11a2b170a256583 Mon Sep 17 00:00:00 2001 From: Indrajeet Patil Date: Wed, 20 Mar 2024 18:03:53 +0100 Subject: [PATCH] don't run crosstabs examples on CRAN --- man/contingency_table.Rd | 156 +++++++++++----------- man/examples/examples-contingency-table.R | 156 +++++++++++----------- 2 files changed, 158 insertions(+), 154 deletions(-) diff --git a/man/contingency_table.Rd b/man/contingency_table.Rd index 62550429..d9cc0f04 100644 --- a/man/contingency_table.Rd +++ b/man/contingency_table.Rd @@ -162,81 +162,83 @@ The table below provides summary about: } \examples{ -#### -------------------- association test ------------------------ #### - -# ------------------------ frequentist --------------------------------- - -# unpaired - -set.seed(123) -contingency_table( - data = mtcars, - x = am, - y = vs, - paired = FALSE -) - -# paired - -paired_data <- tibble( - response_before = structure(c(1L, 2L, 1L, 2L), levels = c("no", "yes"), class = "factor"), - response_after = structure(c(1L, 1L, 2L, 2L), levels = c("no", "yes"), class = "factor"), - Freq = c(65L, 25L, 5L, 5L) -) - -set.seed(123) -contingency_table( - data = paired_data, - x = response_before, - y = response_after, - paired = TRUE, - counts = Freq -) - -# ------------------------ Bayesian ------------------------------------- - -# unpaired - -set.seed(123) -contingency_table( - data = mtcars, - x = am, - y = vs, - paired = FALSE, - type = "bayes" -) - -# paired - -set.seed(123) -contingency_table( - data = paired_data, - x = response_before, - y = response_after, - paired = TRUE, - counts = Freq, - type = "bayes" -) - -#### -------------------- goodness-of-fit test -------------------- #### - -# ------------------------ frequentist --------------------------------- - -set.seed(123) -contingency_table( - data = as.data.frame(HairEyeColor), - x = Eye, - counts = Freq -) - -# ------------------------ Bayesian ------------------------------------- - -set.seed(123) -contingency_table( - data = as.data.frame(HairEyeColor), - x = Eye, - counts = Freq, - ratio = c(0.2, 0.2, 0.3, 0.3), - type = "bayes" -) +if (identical(Sys.getenv("NOT_CRAN"), "true")) { + #### -------------------- association test ------------------------ #### + + # ------------------------ frequentist --------------------------------- + + # unpaired + + set.seed(123) + contingency_table( + data = mtcars, + x = am, + y = vs, + paired = FALSE + ) + + # paired + + paired_data <- tibble( + response_before = structure(c(1L, 2L, 1L, 2L), levels = c("no", "yes"), class = "factor"), + response_after = structure(c(1L, 1L, 2L, 2L), levels = c("no", "yes"), class = "factor"), + Freq = c(65L, 25L, 5L, 5L) + ) + + set.seed(123) + contingency_table( + data = paired_data, + x = response_before, + y = response_after, + paired = TRUE, + counts = Freq + ) + + # ------------------------ Bayesian ------------------------------------- + + # unpaired + + set.seed(123) + contingency_table( + data = mtcars, + x = am, + y = vs, + paired = FALSE, + type = "bayes" + ) + + # paired + + set.seed(123) + contingency_table( + data = paired_data, + x = response_before, + y = response_after, + paired = TRUE, + counts = Freq, + type = "bayes" + ) + + #### -------------------- goodness-of-fit test -------------------- #### + + # ------------------------ frequentist --------------------------------- + + set.seed(123) + contingency_table( + data = as.data.frame(HairEyeColor), + x = Eye, + counts = Freq + ) + + # ------------------------ Bayesian ------------------------------------- + + set.seed(123) + contingency_table( + data = as.data.frame(HairEyeColor), + x = Eye, + counts = Freq, + ratio = c(0.2, 0.2, 0.3, 0.3), + type = "bayes" + ) +} } diff --git a/man/examples/examples-contingency-table.R b/man/examples/examples-contingency-table.R index f6bdd083..66fa847b 100644 --- a/man/examples/examples-contingency-table.R +++ b/man/examples/examples-contingency-table.R @@ -1,77 +1,79 @@ -#### -------------------- association test ------------------------ #### - -# ------------------------ frequentist --------------------------------- - -# unpaired - -set.seed(123) -contingency_table( - data = mtcars, - x = am, - y = vs, - paired = FALSE -) - -# paired - -paired_data <- tibble( - response_before = structure(c(1L, 2L, 1L, 2L), levels = c("no", "yes"), class = "factor"), - response_after = structure(c(1L, 1L, 2L, 2L), levels = c("no", "yes"), class = "factor"), - Freq = c(65L, 25L, 5L, 5L) -) - -set.seed(123) -contingency_table( - data = paired_data, - x = response_before, - y = response_after, - paired = TRUE, - counts = Freq -) - -# ------------------------ Bayesian ------------------------------------- - -# unpaired - -set.seed(123) -contingency_table( - data = mtcars, - x = am, - y = vs, - paired = FALSE, - type = "bayes" -) - -# paired - -set.seed(123) -contingency_table( - data = paired_data, - x = response_before, - y = response_after, - paired = TRUE, - counts = Freq, - type = "bayes" -) - -#### -------------------- goodness-of-fit test -------------------- #### - -# ------------------------ frequentist --------------------------------- - -set.seed(123) -contingency_table( - data = as.data.frame(HairEyeColor), - x = Eye, - counts = Freq -) - -# ------------------------ Bayesian ------------------------------------- - -set.seed(123) -contingency_table( - data = as.data.frame(HairEyeColor), - x = Eye, - counts = Freq, - ratio = c(0.2, 0.2, 0.3, 0.3), - type = "bayes" -) +if (identical(Sys.getenv("NOT_CRAN"), "true")) { + #### -------------------- association test ------------------------ #### + + # ------------------------ frequentist --------------------------------- + + # unpaired + + set.seed(123) + contingency_table( + data = mtcars, + x = am, + y = vs, + paired = FALSE + ) + + # paired + + paired_data <- tibble( + response_before = structure(c(1L, 2L, 1L, 2L), levels = c("no", "yes"), class = "factor"), + response_after = structure(c(1L, 1L, 2L, 2L), levels = c("no", "yes"), class = "factor"), + Freq = c(65L, 25L, 5L, 5L) + ) + + set.seed(123) + contingency_table( + data = paired_data, + x = response_before, + y = response_after, + paired = TRUE, + counts = Freq + ) + + # ------------------------ Bayesian ------------------------------------- + + # unpaired + + set.seed(123) + contingency_table( + data = mtcars, + x = am, + y = vs, + paired = FALSE, + type = "bayes" + ) + + # paired + + set.seed(123) + contingency_table( + data = paired_data, + x = response_before, + y = response_after, + paired = TRUE, + counts = Freq, + type = "bayes" + ) + + #### -------------------- goodness-of-fit test -------------------- #### + + # ------------------------ frequentist --------------------------------- + + set.seed(123) + contingency_table( + data = as.data.frame(HairEyeColor), + x = Eye, + counts = Freq + ) + + # ------------------------ Bayesian ------------------------------------- + + set.seed(123) + contingency_table( + data = as.data.frame(HairEyeColor), + x = Eye, + counts = Freq, + ratio = c(0.2, 0.2, 0.3, 0.3), + type = "bayes" + ) +}