diff --git a/.pre-commit-config.yaml b/.pre-commit-config.yaml index 4851295da..af0e4aa77 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 - insightsengineering/teal diff --git a/DESCRIPTION b/DESCRIPTION index 804387e3f..4fa477eb2 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,7 +1,7 @@ Type: Package Package: teal.modules.general Title: General Modules for 'teal' Applications -Version: 0.5.0.9009 +Version: 0.5.1.9009 Date: 2025-10-17 Authors@R: c( person("Dawid", "Kaledkowski", , "dawid.kaledkowski@roche.com", role = c("aut", "cre")), @@ -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 2873ca1cd..b6dd212cf 100644 --- a/NEWS.md +++ b/NEWS.md @@ -4,6 +4,10 @@ - Modules now return a `teal_report` object that contains the data, code and reporter. All the reporter buttons were removed from the modules' UI. +# 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 13d1c2372..8516efc9b 100644 --- a/R/tm_g_association.R +++ b/R/tm_g_association.R @@ -345,7 +345,7 @@ srv_tm_g_association <- function(id, teal.reporter::teal_card(obj), teal.reporter::teal_card("## Module's output(s)") ) - teal.code::eval_code(obj, 'library("ggplot2");library("dplyr");library("ggmosaic")') # nolint: quotes + teal.code::eval_code(obj, 'library("ggplot2");library("dplyr")') # 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 bffecd3f3..4bb60d406 100644 --- a/R/tm_g_bivariate.R +++ b/R/tm_g_bivariate.R @@ -927,13 +927,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..c85d4fd1b 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" + error_message ) - testthat::expect_match( + 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 ) })