diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index ba9d5b163..ef054797a 100644 --- a/.pre-commit-config.yaml +++ b/.pre-commit-config.yaml @@ -15,7 +15,6 @@ repos: - id: roxygenize name: Regenerate package documentation additional_dependencies: - - ggmosaic - ggplot2 - shiny - checkmate diff --git a/DESCRIPTION b/DESCRIPTION index b95c0cae8..62f2c2963 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -23,7 +23,6 @@ URL: https://insightsengineering.github.io/teal.modules.general/, BugReports: https://github.com/insightsengineering/teal.modules.general/issues Depends: - ggmosaic (>= 0.3.0), ggplot2 (>= 3.4.0), R (>= 4.1), shiny (>= 1.8.1), diff --git a/NAMESPACE b/NAMESPACE index 9c0f1aa0f..302a2f68e 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -25,7 +25,6 @@ export(tm_missing_data) export(tm_outliers) export(tm_t_crosstable) export(tm_variable_browser) -import(ggmosaic) import(ggplot2) import(shiny) import(teal) diff --git a/NEWS.md b/NEWS.md index 5883bf4ce..0415944dc 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,3 +1,7 @@ +# teal.modules.general 0.5.1 + +- Removed ggmosaic package dependency to avoid being archived on CRAN (#932). + # teal.modules.general 0.5.0 ### Breaking changes diff --git a/R/teal.modules.general.R b/R/teal.modules.general.R index 82f61a562..07e7cf03c 100644 --- a/R/teal.modules.general.R +++ b/R/teal.modules.general.R @@ -4,7 +4,6 @@ #' (not necessarily for clinical trials data). #' #' @import ggplot2 -#' @import ggmosaic #' @import shiny #' @import teal #' @import teal.transform @@ -15,11 +14,5 @@ #' @keywords internal "_PACKAGE" -# nolint start -# Note ggmosaic (version <= 0.3.3) needs to be in DEPENDS as the following does not work if it is imported -# df <- data.frame(x = c("A", "B", "C", "A"), y = c("Z", "Z", "W", "W")) -# ggplot(df) + ggmosaic::geom_mosaic(aes(x = ggmosaic::product(x), fill = y)) -# nolint end - # Needed to avoid R CMD note on no visible binding utils::globalVariables("count") diff --git a/R/tm_g_association.R b/R/tm_g_association.R index eb679a02c..e71af1266 100644 --- a/R/tm_g_association.R +++ b/R/tm_g_association.R @@ -348,7 +348,7 @@ srv_tm_g_association <- function(id, ) qenv <- reactive( - teal.code::eval_code(data(), 'library("ggplot2");library("dplyr");library("tern");library("ggmosaic")') # nolint quotes + teal.code::eval_code(data(), 'library("ggplot2");library("dplyr");library("tern")') # nolint quotes ) anl_merged_q <- reactive({ req(anl_merged_input()) diff --git a/R/tm_g_bivariate.R b/R/tm_g_bivariate.R index ced291b6f..acf36b3fb 100644 --- a/R/tm_g_bivariate.R +++ b/R/tm_g_bivariate.R @@ -968,13 +968,7 @@ bivariate_ggplot_call <- function(x_class, ) # Factor and character plots } else if (x_class == "factor" && y_class == "factor") { - plot_call <- reduce_plot_call( - plot_call, - substitute( - ggmosaic::geom_mosaic(aes(x = ggmosaic::product(xval), fill = yval), na.rm = TRUE), - env = list(xval = x, yval = y) - ) - ) + stop("Categorical variables 'x' and 'y' are currently not supported.") } else { stop("x y type combination not allowed") } diff --git a/inst/WORDLIST b/inst/WORDLIST index 3e794b12f..0fcba0427 100644 --- a/inst/WORDLIST +++ b/inst/WORDLIST @@ -8,6 +8,7 @@ UI datatables facetting funder +ggmosaic ggplot pre qq diff --git a/tests/testthat/test_bivariate_ggplot_call.R b/tests/testthat/test_bivariate_ggplot_call.R index 30e6eebac..ab822ced4 100644 --- a/tests/testthat/test_bivariate_ggplot_call.R +++ b/tests/testthat/test_bivariate_ggplot_call.R @@ -19,33 +19,34 @@ testthat::test_that("bivariate_ggplot_call with numerics", { }) testthat::test_that("bivariate_ggplot_call with factor, char, logical", { - testthat::expect_match( + error_message <- "Categorical variables 'x' and 'y' are currently not supported." + testthat::expect_error( bivariate_ggplot_call("factor", "factor") %>% deparse(width.cutoff = 300), - "geom_mosaic" + error_message ) - testthat::expect_match( + testthat::expect_error( bivariate_ggplot_call("logical", "factor") %>% deparse(width.cutoff = 300), - "geom_mosaic" - ) - testthat::expect_match( + error_message + ) + testthat::expect_error( bivariate_ggplot_call("character", "factor") %>% deparse(width.cutoff = 300), - "geom_mosaic" + error_message ) - testthat::expect_match( + testthat::expect_error( bivariate_ggplot_call("logical", "character") %>% deparse(width.cutoff = 300), - "geom_mosaic" + error_message ) - testthat::expect_match( + testthat::expect_error( bivariate_ggplot_call("character", "logical") %>% deparse(width.cutoff = 300), - "geom_mosaic" + error_message ) - testthat::expect_match( + testthat::expect_error( bivariate_ggplot_call("logical", "logical") %>% deparse(width.cutoff = 300), - "geom_mosaic" + error_message ) - testthat::expect_match( + testthat::expect_error( bivariate_ggplot_call("character", "character") %>% deparse(width.cutoff = 300), - "geom\\_mosaic" + error_message ) })