diff --git a/NAMESPACE b/NAMESPACE index 6fe52a47b..defe34671 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -167,6 +167,7 @@ importFrom(grid,upViewport) importFrom(grid,viewport) importFrom(gtable,gtable_filter) importFrom(lifecycle,deprecate_soft) +importFrom(lifecycle,deprecated) importFrom(magrittr,"%>%") importFrom(plyr,ddply) importFrom(plyr,summarize) diff --git a/R/GGally-package.R b/R/GGally-package.R index 5a69da1a9..8324eb090 100644 --- a/R/GGally-package.R +++ b/R/GGally-package.R @@ -5,6 +5,7 @@ # roxygen namespace tags. Modify with care! ## usethis namespace: start #' @importFrom lifecycle deprecate_soft +#' @importFrom lifecycle deprecated ## usethis namespace: end NULL diff --git a/R/ggpairs.R b/R/ggpairs.R index 59ced19c1..b41419031 100644 --- a/R/ggpairs.R +++ b/R/ggpairs.R @@ -128,15 +128,6 @@ fix_column_values <- function( columns } -warn_deprecated <- function(is_supplied, title) { - if (is_supplied) { - warning(paste( - "'", title, "' will be deprecated in future versions. Please remove it from your code", - sep = "" - )) - } -} - stop_if_bad_mapping <- function(mapping) { if (is.numeric(mapping)) { stop( @@ -146,18 +137,6 @@ stop_if_bad_mapping <- function(mapping) { } } -warn_if_args_exist <- function(args) { - if (length(args) > 0) { - argNames <- names(args) - warning(str_c( - "Extra arguments: ", - str_c(shQuote(argNames), collapse = ", "), " are being ignored.", - " If these are meant to be aesthetics, submit them using the", - " 'mapping' variable within ggpairs with ggplot2::aes or ggplot2::aes_string." - )) - } -} - fix_axis_label_choice <- function(axisLabels, axisLabelChoices) { if (length(axisLabels) > 1) { axisLabels <- axisLabels[1] @@ -234,7 +213,7 @@ stop_if_high_cardinality <- function(data, columns, threshold) { #' @template ggmatrix-legend-param #' @param cardinality_threshold maximum number of levels allowed in a character / factor column. Set this value to NULL to not check factor columns. Defaults to 15 #' @template ggmatrix-progress -#' @param legends deprecated +#' @param legends `r lifecycle::badge('deprecated')` #' @param xProportions,yProportions Value to change how much area is given for each plot. Either \code{NULL} (default), numeric value matching respective length, \code{grid::\link[grid]{unit}} object with matching respective length or \code{"auto"} for automatic relative proportions based on the number of levels for categorical variables. #' @export #' @examples @@ -456,8 +435,14 @@ ggduo <- function( progress = NULL, xProportions = NULL, yProportions = NULL, - legends = stop("deprecated")) { - warn_deprecated(!missing(legends), "legends") + legends = deprecated()) { + if (lifecycle::is_present(legends)) { + lifecycle::deprecate_warn( + when = "2.2.2", + what = "ggduo(legends)", + details = "Ability to put legends in each plot will be dropped in next releases." + ) + } isSharedData <- inherits(data, "SharedData") data_ <- fix_data(data) @@ -623,8 +608,8 @@ ggduo <- function( #' @param upper see Details #' @param lower see Details #' @param diag see Details -#' @param params deprecated. Please see \code{\link{wrap_fn_with_param_arg}} -#' @param ... deprecated. Please use \code{mapping} +#' @param params `r lifecycle::badge("deprecated")` see \code{\link{wrap_fn_with_param_arg}} +#' @param ... `r lifecycle::badge("deprecated")` use \code{mapping} #' @param axisLabels either "show" to display axisLabels, "internal" for labels in the diagonal plots, or "none" for no axis labels #' @param columnLabels label names to be displayed. Defaults to names of columns being used. #' @param proportions Value to change how much area is given for each plot. Either \code{NULL} (default), numeric value matching respective length, \code{grid::\link[grid]{unit}} object with matching respective length or \code{"auto"} for automatic relative proportions based on the number of levels for categorical variables. @@ -634,7 +619,7 @@ ggduo <- function( #' @template ggmatrix-legend-param #' @param cardinality_threshold maximum number of levels allowed in a character / factor column. Set this value to NULL to not check factor columns. Defaults to 15 #' @template ggmatrix-progress -#' @param legends deprecated +#' @param legends `r lifecycle::badge("deprecated")` #' @keywords hplot #' @import ggplot2 #' @references John W Emerson, Walton A Green, Barret Schloerke, Jason Crowley, Dianne Cook, Heike Hofmann, Hadley Wickham. The Generalized Pairs Plot. Journal of Computational and Graphical Statistics, vol. 22, no. 1, pp. 79-91, 2012. @@ -768,7 +753,7 @@ ggpairs <- function( upper = list(continuous = "cor", combo = "box_no_facet", discrete = "count", na = "na"), lower = list(continuous = "points", combo = "facethist", discrete = "facetbar", na = "na"), diag = list(continuous = "densityDiag", discrete = "barDiag", na = "naDiag"), - params = NULL, + params = deprecated(), ..., xlab = NULL, ylab = NULL, @@ -781,10 +766,26 @@ ggpairs <- function( cardinality_threshold = 15, progress = NULL, proportions = NULL, - legends = stop("deprecated")) { - warn_deprecated(!missing(legends), "legends") - warn_if_args_exist(list(...)) - stop_if_params_exist(params) + legends = deprecated()) { + if (lifecycle::is_present(legends)) { + lifecycle::deprecate_warn( + when = "2.2.2", + what = "ggpairs(legends)", + details = "Ability to put legends in each plot will be dropped in next releases." + ) + } + if (lifecycle::is_present(params)) { + lifecycle::deprecate_warn( + when = "2.2.2", + what = "ggpairs(params)" + ) + } + has_dots <- rlang::check_dots_empty(error = function(cnd) { + TRUE + }) + if (isTRUE(has_dots)) { + lifecycle::deprecate_soft(when = "2.2.2", what = "ggpais(...)") + } isSharedData <- inherits(data, "SharedData") diff --git a/man/figures/lifecycle-archived.svg b/man/figures/lifecycle-archived.svg index 48f72a6f3..745ab0c78 100644 --- a/man/figures/lifecycle-archived.svg +++ b/man/figures/lifecycle-archived.svg @@ -1 +1,21 @@ - lifecyclelifecyclearchivedarchived \ No newline at end of file + + lifecycle: archived + + + + + + + + + + + + + + + lifecycle + + archived + + diff --git a/man/figures/lifecycle-defunct.svg b/man/figures/lifecycle-defunct.svg index 01452e5fb..d5c9559ed 100644 --- a/man/figures/lifecycle-defunct.svg +++ b/man/figures/lifecycle-defunct.svg @@ -1 +1,21 @@ -lifecyclelifecycledefunctdefunct \ No newline at end of file + + lifecycle: defunct + + + + + + + + + + + + + + + lifecycle + + defunct + + diff --git a/man/figures/lifecycle-deprecated.svg b/man/figures/lifecycle-deprecated.svg index 4baaee01c..b61c57c3f 100644 --- a/man/figures/lifecycle-deprecated.svg +++ b/man/figures/lifecycle-deprecated.svg @@ -1 +1,21 @@ -lifecyclelifecycledeprecateddeprecated \ No newline at end of file + + lifecycle: deprecated + + + + + + + + + + + + + + + lifecycle + + deprecated + + diff --git a/man/figures/lifecycle-experimental.svg b/man/figures/lifecycle-experimental.svg index d1d060e92..5d88fc2c6 100644 --- a/man/figures/lifecycle-experimental.svg +++ b/man/figures/lifecycle-experimental.svg @@ -1 +1,21 @@ -lifecyclelifecycleexperimentalexperimental \ No newline at end of file + + lifecycle: experimental + + + + + + + + + + + + + + + lifecycle + + experimental + + diff --git a/man/figures/lifecycle-maturing.svg b/man/figures/lifecycle-maturing.svg index df7131014..897370ecf 100644 --- a/man/figures/lifecycle-maturing.svg +++ b/man/figures/lifecycle-maturing.svg @@ -1 +1,21 @@ -lifecyclelifecyclematuringmaturing \ No newline at end of file + + lifecycle: maturing + + + + + + + + + + + + + + + lifecycle + + maturing + + diff --git a/man/figures/lifecycle-questioning.svg b/man/figures/lifecycle-questioning.svg index 08ee0c903..7c1721d05 100644 --- a/man/figures/lifecycle-questioning.svg +++ b/man/figures/lifecycle-questioning.svg @@ -1 +1,21 @@ -lifecyclelifecyclequestioningquestioning \ No newline at end of file + + lifecycle: questioning + + + + + + + + + + + + + + + lifecycle + + questioning + + diff --git a/man/figures/lifecycle-soft-deprecated.svg b/man/figures/lifecycle-soft-deprecated.svg index 9f014fd19..9c166ff30 100644 --- a/man/figures/lifecycle-soft-deprecated.svg +++ b/man/figures/lifecycle-soft-deprecated.svg @@ -1 +1,21 @@ -lifecyclelifecyclesoft-deprecatedsoft-deprecated \ No newline at end of file + + lifecycle: soft-deprecated + + + + + + + + + + + + + + + lifecycle + + soft-deprecated + + diff --git a/man/figures/lifecycle-stable.svg b/man/figures/lifecycle-stable.svg index e015dc811..9bf21e76b 100644 --- a/man/figures/lifecycle-stable.svg +++ b/man/figures/lifecycle-stable.svg @@ -1 +1,29 @@ -lifecyclelifecyclestablestable \ No newline at end of file + + lifecycle: stable + + + + + + + + + + + + + + + + lifecycle + + + + stable + + + diff --git a/man/figures/lifecycle-superseded.svg b/man/figures/lifecycle-superseded.svg index 75f24f553..db8d757f7 100644 --- a/man/figures/lifecycle-superseded.svg +++ b/man/figures/lifecycle-superseded.svg @@ -1 +1,21 @@ - lifecyclelifecyclesupersededsuperseded \ No newline at end of file + + lifecycle: superseded + + + + + + + + + + + + + + + lifecycle + + superseded + + diff --git a/man/ggduo.Rd b/man/ggduo.Rd index b8f97a316..5ffd37901 100644 --- a/man/ggduo.Rd +++ b/man/ggduo.Rd @@ -25,7 +25,7 @@ ggduo( progress = NULL, xProportions = NULL, yProportions = NULL, - legends = stop("deprecated") + legends = deprecated() ) } \arguments{ @@ -57,7 +57,7 @@ ggduo( \item{xProportions, yProportions}{Value to change how much area is given for each plot. Either \code{NULL} (default), numeric value matching respective length, \code{grid::\link[grid]{unit}} object with matching respective length or \code{"auto"} for automatic relative proportions based on the number of levels for categorical variables.} -\item{legends}{deprecated} +\item{legends}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}}} } \description{ Make a matrix of plots with a given data set with two different column sets diff --git a/man/ggpairs.Rd b/man/ggpairs.Rd index 23a566ef0..cb49e89d1 100644 --- a/man/ggpairs.Rd +++ b/man/ggpairs.Rd @@ -13,7 +13,7 @@ ggpairs( lower = list(continuous = "points", combo = "facethist", discrete = "facetbar", na = "na"), diag = list(continuous = "densityDiag", discrete = "barDiag", na = "naDiag"), - params = NULL, + params = deprecated(), ..., xlab = NULL, ylab = NULL, @@ -26,7 +26,7 @@ ggpairs( cardinality_threshold = 15, progress = NULL, proportions = NULL, - legends = stop("deprecated") + legends = deprecated() ) } \arguments{ @@ -44,9 +44,9 @@ ggpairs( \item{diag}{see Details} -\item{params}{deprecated. Please see \code{\link{wrap_fn_with_param_arg}}} +\item{params}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} see \code{\link{wrap_fn_with_param_arg}}} -\item{...}{deprecated. Please use \code{mapping}} +\item{...}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} use \code{mapping}} \item{axisLabels}{either "show" to display axisLabels, "internal" for labels in the diagonal plots, or "none" for no axis labels} @@ -66,7 +66,7 @@ ggpairs( \item{proportions}{Value to change how much area is given for each plot. Either \code{NULL} (default), numeric value matching respective length, \code{grid::\link[grid]{unit}} object with matching respective length or \code{"auto"} for automatic relative proportions based on the number of levels for categorical variables.} -\item{legends}{deprecated} +\item{legends}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}}} } \value{ \code{\link{ggmatrix}} object that if called, will print diff --git a/tests/testthat/test-zzz_ggpairs.R b/tests/testthat/test-zzz_ggpairs.R index b99837ead..8154ea536 100644 --- a/tests/testthat/test-zzz_ggpairs.R +++ b/tests/testthat/test-zzz_ggpairs.R @@ -134,11 +134,10 @@ test_that("stops", { "'axisLabels' not in " ) # nolint - expect_warning( + lifecycle::expect_deprecated( { pm <- ggpairs(tips, color = "sex") }, - "Extra arguments: " ) # nolint expect_warning( @@ -167,18 +166,16 @@ test_that("stops", { "Columns in 'columnsY' not found in data" ) # nolint - expect_warning( + lifecycle::expect_deprecated( { pm <- ggpairs(tips, legends = TRUE) - }, - "'legends' will be deprecated" + } ) # nolint - expect_error( + lifecycle::expect_deprecated( { ggpairs(tips, params = c(size = 2)) - }, - "'params' is a deprecated" + } ) # nolint expect_error(