diff --git a/NEWS.md b/NEWS.md index 12445271..5b5b511b 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,7 @@ # GGally (development version) +* Use lifecycle for deprecation warnings (#494, #496) + # GGally 2.2.1 * Fix compatibility with ggplot2 3.5.0 (@teunbrand, #481) diff --git a/R/gg-plots.R b/R/gg-plots.R index 588722f2..1cbbcab9 100644 --- a/R/gg-plots.R +++ b/R/gg-plots.R @@ -261,10 +261,11 @@ ggally_density <- function(data, mapping, ...) { #' @param group_args arguments being supplied to the split-by-color group's \code{\link[ggplot2]{geom_text}()} #' @param justify_labels \code{justify} argument supplied when \code{\link[base]{format}}ting the labels #' @param align_percent relative align position of the text. When \code{justify_labels = 0.5}, this should not be needed to be set. -#' @param alignPercent,displayGrid deprecated. Please use their snake-case counterparts. +#' @param alignPercent,displayGrid `r lifecycle::badge("deprecated")`. Please use their snake-case counterparts. #' @param title title text to be displayed #' @author Barret Schloerke #' @importFrom stats complete.cases cor +#' @importFrom lifecycle deprecated #' @seealso \code{\link{ggally_statistic}}, \code{\link{ggally_cor_v1_5}} #' @export #' @keywords hplot @@ -308,14 +309,22 @@ ggally_cor <- function( justify_labels = "right", align_percent = 0.5, title = "Corr", - alignPercent = warning("deprecated. Use `align_percent`"), - displayGrid = warning("deprecated. Use `display_grid`")) { - if (!missing(alignPercent)) { - warning("`alignPercent` is deprecated. Please use `align_percent` if alignment still needs to be adjusted") + alignPercent = deprecated(), + displayGrid = deprecated()) { + if (lifecycle::is_present(alignPercent)) { + lifecycle::deprecate_soft( + when = "2.2.2", + what = "ggally_cor(alignPercent)", + details = "Please use `align_percent` if alignment still needs to be adjusted." + ) align_percent <- alignPercent } - if (!missing(displayGrid)) { - warning("`displayGrid` is deprecated. Please use `display_grid`") + if (lifecycle::is_present(displayGrid)) { + lifecycle::deprecate_soft( + when = "2.2.2", + what = "ggally_cor(displayGrid)", + details = "Please use `display_grid`" + ) display_grid <- displayGrid } diff --git a/man/ggally_cor.Rd b/man/ggally_cor.Rd index 13a33a78..cc361f86 100644 --- a/man/ggally_cor.Rd +++ b/man/ggally_cor.Rd @@ -18,8 +18,8 @@ ggally_cor( justify_labels = "right", align_percent = 0.5, title = "Corr", - alignPercent = warning("deprecated. Use `align_percent`"), - displayGrid = warning("deprecated. Use `display_grid`") + alignPercent = deprecated(), + displayGrid = deprecated() ) } \arguments{ @@ -55,7 +55,7 @@ ggally_cor( \item{title}{title text to be displayed} -\item{alignPercent, displayGrid}{deprecated. Please use their snake-case counterparts.} +\item{alignPercent, displayGrid}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}}. Please use their snake-case counterparts.} } \description{ Estimate correlation from the given data. If a color variable is supplied, the correlation will also be calculated per group.