From 91707303c37d523d5a1e78e2bae9e2bd1be42d49 Mon Sep 17 00:00:00 2001 From: Thomas Lin Pedersen Date: Tue, 1 Mar 2022 13:26:07 +0100 Subject: [PATCH 01/13] standardise description --- DESCRIPTION | 50 ++++++++++++++++++++++++-------------------------- 1 file changed, 24 insertions(+), 26 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 89af5c1bd2..4488507841 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -1,18 +1,14 @@ Package: ggplot2 -Version: 3.3.5.9000 Title: Create Elegant Data Visualisations Using the Grammar of Graphics -Description: A system for 'declaratively' creating graphics, - based on "The Grammar of Graphics". You provide the data, tell 'ggplot2' - how to map variables to aesthetics, what graphical primitives to use, - and it takes care of the details. +Version: 3.3.5.9000 Authors@R: c( - person("Hadley", "Wickham", , "hadley@rstudio.com", "aut", + person("Hadley", "Wickham", , "hadley@rstudio.com", role = "aut", comment = c(ORCID = "0000-0003-4757-117X")), - person("Winston", "Chang", , role = "aut", + person("Winston", "Chang", role = "aut", comment = c(ORCID = "0000-0002-1576-2126")), - person("Lionel", "Henry", , role = "aut"), - person("Thomas Lin", "Pedersen", , "thomas.pedersen@rstudio.com", - role = c("aut", "cre"), comment = c(ORCID = "0000-0002-5147-4711")), + person("Lionel", "Henry", role = "aut"), + person("Thomas Lin", "Pedersen", , "thomas.pedersen@rstudio.com", role = c("aut", "cre"), + comment = c(ORCID = "0000-0002-5147-4711")), person("Kohske", "Takahashi", role = "aut"), person("Claus", "Wilke", role = "aut", comment = c(ORCID = "0000-0002-7470-9261")), @@ -23,7 +19,14 @@ Authors@R: c( person("Dewey", "Dunnington", role = "aut", comment = c(ORCID = "0000-0002-9415-4582")), person("RStudio", role = c("cph", "fnd")) - ) + ) +Description: A system for 'declaratively' creating graphics, based on "The + Grammar of Graphics". You provide the data, tell 'ggplot2' how to map + variables to aesthetics, what graphical primitives to use, and it + takes care of the details. +License: MIT + file LICENSE +URL: https://ggplot2.tidyverse.org, https://github.com/tidyverse/ggplot2 +BugReports: https://github.com/tidyverse/ggplot2/issues Depends: R (>= 3.3) Imports: @@ -42,7 +45,6 @@ Imports: withr (>= 2.0.0) Suggests: covr, - ragg, dplyr, ggplot2movies, hexbin, @@ -58,6 +60,7 @@ Suggests: nlme, profvis, quantreg, + ragg, RColorBrewer, rgeos, rmarkdown, @@ -67,11 +70,16 @@ Suggests: testthat (>= 3.0.0), vdiffr (>= 1.0.0), xml2 -Enhances: sp -License: MIT + file LICENSE -URL: https://ggplot2.tidyverse.org, https://github.com/tidyverse/ggplot2 -BugReports: https://github.com/tidyverse/ggplot2/issues +Enhances: + sp +VignetteBuilder: + knitr +Config/Needs/website: ggtext, tidyr, forcats, tidyverse/tidytemplate +Config/testthat/edition: 3 +Encoding: UTF-8 LazyData: true +Roxygen: list(markdown = TRUE) +RoxygenNote: 7.1.1 Collate: 'ggproto.r' 'ggplot-global.R' @@ -265,13 +273,3 @@ Collate: 'utilities-tidy-eval.R' 'zxx.r' 'zzz.r' -VignetteBuilder: knitr -RoxygenNote: 7.1.1 -Roxygen: list(markdown = TRUE) -Encoding: UTF-8 -Config/Needs/website: - ggtext, - tidyr, - forcats, - tidyverse/tidytemplate -Config/testthat/edition: 3 From 5edc94170cb3f46457ded546395c65e19e831cfd Mon Sep 17 00:00:00 2001 From: Thomas Lin Pedersen Date: Tue, 1 Mar 2022 13:26:24 +0100 Subject: [PATCH 02/13] standardise package doc and imports --- R/{ggplot2.r => ggplot2-package.R} | 2 ++ 1 file changed, 2 insertions(+) rename R/{ggplot2.r => ggplot2-package.R} (72%) diff --git a/R/ggplot2.r b/R/ggplot2-package.R similarity index 72% rename from R/ggplot2.r rename to R/ggplot2-package.R index 0cdacd84cd..4609675d9e 100644 --- a/R/ggplot2.r +++ b/R/ggplot2-package.R @@ -1,7 +1,9 @@ #' @keywords internal "_PACKAGE" +## usethis namespace: start #' @import scales grid gtable rlang #' @importFrom stats setNames #' @importFrom glue glue glue_collapse +## usethis namespace: end NULL From 48aff277da2b4038a8763dbdf191d79b6b86686e Mon Sep 17 00:00:00 2001 From: Thomas Lin Pedersen Date: Thu, 3 Mar 2022 09:57:58 +0100 Subject: [PATCH 03/13] Update deprecations to lifecycle --- DESCRIPTION | 3 ++- NEWS.md | 3 +++ R/aes.r | 21 ++++++++++++++++++++- R/coord-transform.r | 12 ++++++------ R/facet-wrap.r | 7 ++++--- R/geom-spoke.r | 2 +- R/ggplot2-package.R | 3 ++- R/guides-.r | 6 +++++- R/labeller.r | 24 ++++++------------------ R/layer.r | 2 +- R/plot.r | 3 ++- R/quick-plot.r | 8 ++++---- R/scale-expansion.r | 2 +- R/stat-bin.r | 8 ++++---- R/stat-summary-bin.R | 16 +++++++++------- R/stat-summary.r | 20 +++++++++++--------- R/theme.r | 17 +++++++++++++---- 17 files changed, 94 insertions(+), 63 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index 4488507841..ecded35724 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -35,6 +35,7 @@ Imports: grDevices, grid, gtable (>= 0.1.1), + lifecycle, isoband, MASS, mgcv, @@ -79,7 +80,7 @@ Config/testthat/edition: 3 Encoding: UTF-8 LazyData: true Roxygen: list(markdown = TRUE) -RoxygenNote: 7.1.1 +RoxygenNote: 7.1.2 Collate: 'ggproto.r' 'ggplot-global.R' diff --git a/NEWS.md b/NEWS.md index 6579c613b1..fd5a9e87b8 100644 --- a/NEWS.md +++ b/NEWS.md @@ -1,5 +1,8 @@ # ggplot2 (development version) +* referring to `x` in backquoted expressions with `label_bquote()` is no longer + possible. + * `position_stack()` now works fully with `geom_text()` (@thomasp85, #4367) * `geom_tile()` now correctly recognises missing data in `xmin`, `xmax`, `ymin`, diff --git a/R/aes.r b/R/aes.r index 4d98c42a8d..a5fe58269d 100644 --- a/R/aes.r +++ b/R/aes.r @@ -212,6 +212,9 @@ is_position_aes <- function(vars) { #' Define aesthetic mappings programmatically #' +#' @description +#' `r lifecycle::badge("deprecated")` +#' #' Aesthetic mappings describe how variables in the data are mapped to visual #' properties (aesthetics) of geoms. [aes()] uses non-standard #' evaluation to capture the variable names. `aes_()` and `aes_string()` @@ -239,6 +242,9 @@ is_position_aes <- function(vars) { #' @param x,y,... List of name value pairs. Elements must be either #' quoted calls, strings, one-sided formulas or constants. #' @seealso [aes()] +#' +#' @keywords internal +#' #' @export #' @examples #' # Three ways of generating the same aesthetics @@ -258,6 +264,11 @@ is_position_aes <- function(vars) { #' aes(col = x) #' aes_(col = as.name(var)) aes_ <- function(x, y, ...) { + lifecycle::deprecate_soft( + "3.0.0", + "aes_()", + details = "Please use tidy evaluation ideoms with `aes()`" + ) mapping <- list(...) if (!missing(x)) mapping["x"] <- list(x) if (!missing(y)) mapping["y"] <- list(y) @@ -280,6 +291,11 @@ aes_ <- function(x, y, ...) { #' @rdname aes_ #' @export aes_string <- function(x, y, ...) { + lifecycle::deprecate_soft( + "3.0.0", + "aes_string()", + details = "Please use tidy evaluation ideoms with `aes()`" + ) mapping <- list(...) if (!missing(x)) mapping["x"] <- list(x) if (!missing(y)) mapping["y"] <- list(y) @@ -321,12 +337,15 @@ aes_all <- function(vars) { #' Automatic aesthetic mapping #' +#' @description +#' `r lifecycle::badge("deprecated")` +#' #' @param data data.frame or names of variables #' @param ... aesthetics that need to be explicitly mapped. #' @keywords internal #' @export aes_auto <- function(data = NULL, ...) { - warn("aes_auto() is deprecated") + lifecycle::deprecate_warn("2.0.0", "aes_auto()") # detect names of data if (is.null(data)) { diff --git a/R/coord-transform.r b/R/coord-transform.r index 1eb902bc11..d4d4aac0fe 100644 --- a/R/coord-transform.r +++ b/R/coord-transform.r @@ -10,7 +10,7 @@ #' #' @inheritParams coord_cartesian #' @param x,y Transformers for x and y axes or their names. -#' @param limx,limy **Deprecated**: use `xlim` and `ylim` instead. +#' @param limx,limy `r lifecycle::badge("deprecated")` use `xlim` and `ylim` instead. #' @export #' @examples #' \donttest{ @@ -75,13 +75,13 @@ #' plot + coord_trans(x = "sqrt") #' } coord_trans <- function(x = "identity", y = "identity", xlim = NULL, ylim = NULL, - limx = "DEPRECATED", limy = "DEPRECATED", clip = "on", expand = TRUE) { - if (!missing(limx)) { - warn("`limx` argument is deprecated; please use `xlim` instead.") + limx = deprecated(), limy = deprecated(), clip = "on", expand = TRUE) { + if (lifecycle::is_present(limx)) { + lifecycle::deprecate_warn("3.3.0", "coord_trans(limx)", "coord_trans(xlim)") xlim <- limx } - if (!missing(limy)) { - warn("`limy` argument is deprecated; please use `ylim` instead.") + if (lifecycle::is_present(limy)) { + lifecycle::deprecate_warn("3.3.0", "coord_trans(limy)", "coord_trans(ylim)") ylim <- limy } diff --git a/R/facet-wrap.r b/R/facet-wrap.r index e6f34cd7af..aef5b56095 100644 --- a/R/facet-wrap.r +++ b/R/facet-wrap.r @@ -79,7 +79,8 @@ NULL #' } facet_wrap <- function(facets, nrow = NULL, ncol = NULL, scales = "fixed", shrink = TRUE, labeller = "label_value", as.table = TRUE, - switch = NULL, drop = TRUE, dir = "h", strip.position = 'top') { + switch = deprecated(), drop = TRUE, dir = "h", + strip.position = 'top') { scales <- match.arg(scales, c("fixed", "free_x", "free_y", "free")) dir <- match.arg(dir, c("h", "v")) free <- list( @@ -93,8 +94,8 @@ facet_wrap <- function(facets, nrow = NULL, ncol = NULL, scales = "fixed", # Flatten all facets dimensions into a single one facets <- wrap_as_facets_list(facets) - if (!is.null(switch)) { - .Deprecated("strip.position", old = "switch") + if (lifecycle::is_present(switch)) { + lifecycle::deprecate_warn("2.2.0", "facet_wrap(switch)", "facet_wrap(strip.position)") strip.position <- if (switch == "x") "bottom" else "left" } strip.position <- match.arg(strip.position, c("top", "bottom", "left", "right")) diff --git a/R/geom-spoke.r b/R/geom-spoke.r index 2b6801a51e..6622f9e0ef 100644 --- a/R/geom-spoke.r +++ b/R/geom-spoke.r @@ -45,7 +45,7 @@ geom_spoke <- function(mapping = NULL, data = NULL, #' @rdname geom_spoke #' @usage NULL stat_spoke <- function(...) { - message("stat_spoke is deprecated, please use geom_spoke") + lifecycle::deprecate_warn("2.0.0", "stat_spoke()", "geom_spoke()") geom_spoke(...) } diff --git a/R/ggplot2-package.R b/R/ggplot2-package.R index 4609675d9e..18ed13674c 100644 --- a/R/ggplot2-package.R +++ b/R/ggplot2-package.R @@ -3,7 +3,8 @@ ## usethis namespace: start #' @import scales grid gtable rlang -#' @importFrom stats setNames #' @importFrom glue glue glue_collapse +#' @importFrom lifecycle deprecated +#' @importFrom stats setNames ## usethis namespace: end NULL diff --git a/R/guides-.r b/R/guides-.r index 9c411dc4ba..058ea6038b 100644 --- a/R/guides-.r +++ b/R/guides-.r @@ -72,7 +72,7 @@ guides <- function(...) { idx_false <- vapply(args, isFALSE, FUN.VALUE = logical(1L)) if (isTRUE(any(idx_false))) { - warn('`guides( = FALSE)` is deprecated. Please use `guides( = "none")` instead.') + lifecycle::deprecate_warn("3.3.4", "guides(`` = 'cannot be `FALSE`. Use \"none\" instead')") args[idx_false] <- "none" } @@ -200,6 +200,10 @@ guides_train <- function(scales, theme, guides, labels) { if (identical(guide, "none") || inherits(guide, "guide_none")) next if (isFALSE(guide)) { + # lifecycle currently doesn't support function name placeholders. + # the below gives us the correct behaviour but is too brittle and hacky + # lifecycle::deprecate_warn("3.3.4", "`scale_*()`(guide = 'cannot be `FALSE`. Use \"none\" instead')") + # TODO: update to lifecycle after next lifecycle release warn('It is deprecated to specify `guide = FALSE` to remove a guide. Please use `guide = "none"` instead.') next } diff --git a/R/labeller.r b/R/labeller.r index 447bcc07f7..dcf9a6d2f5 100644 --- a/R/labeller.r +++ b/R/labeller.r @@ -203,7 +203,6 @@ label_bquote <- function(rows = NULL, cols = NULL, default) { cols_quoted <- substitute(cols) rows_quoted <- substitute(rows) - has_warned <- FALSE call_env <- env_parent() @@ -215,18 +214,6 @@ label_bquote <- function(rows = NULL, cols = NULL, evaluate <- function(...) { params <- list(...) - - # Mapping `x` to the first variable for backward-compatibility, - # but only if there is no facetted variable also named `x` - if ("x" %in% find_names(quoted) && !"x" %in% names(params)) { - if (!has_warned) { - warn("Referring to `x` is deprecated, use variable name instead") - # The function is called for each facet so this avoids - # multiple warnings - has_warned <<- TRUE - } - params$x <- params[[1]] - } params <- as_environment(params, call_env) eval(substitute(bquote(expr, params), list(expr = quoted))) } @@ -351,8 +338,8 @@ as_labeller <- function(x, default = label_value, multi_line = TRUE) { #' the columns). It is passed to [as_labeller()]. When a #' margin-wide labeller is set, make sure you don't mention in #' `...` any variable belonging to the margin. -#' @param keep.as.numeric Deprecated. All supplied labellers and -#' on-labeller functions should be able to work with character +#' @param keep.as.numeric `r lifecycle::badge("deprecated")` All supplied +#' labellers and on-labeller functions should be able to work with character #' labels. #' @param .multi_line Whether to display the labels of multiple #' factors on separate lines. This is passed to the labeller @@ -430,10 +417,10 @@ as_labeller <- function(x, default = label_value, multi_line = TRUE) { #' p3 + facet_wrap(~conservation2, labeller = global_labeller) #' } labeller <- function(..., .rows = NULL, .cols = NULL, - keep.as.numeric = NULL, .multi_line = TRUE, + keep.as.numeric = deprecated(), .multi_line = TRUE, .default = label_value) { - if (!is.null(keep.as.numeric)) { - .Deprecated(old = "keep.as.numeric") + if (lifecycle::is_present(keep.as.numeric)) { + lifecycle::deprecate_warn("2.0.0", "labeller(keep.as.numeric)") } dots <- list(...) .default <- as_labeller(.default) @@ -622,6 +609,7 @@ check_labeller <- function(labeller) { labeller <- function(labels) { Map(old_labeller, names(labels), labels) } + # TODO Update to lifecycle after next lifecycle release warn(glue( "The labeller API has been updated. Labellers taking `variable` ", "and `value` arguments are now deprecated. See labellers documentation.")) diff --git a/R/layer.r b/R/layer.r index dcb66f92bf..fa8be9400f 100644 --- a/R/layer.r +++ b/R/layer.r @@ -77,7 +77,7 @@ layer <- function(geom = NULL, stat = NULL, # Handle show_guide/show.legend if (!is.null(params$show_guide)) { - warn("`show_guide` has been deprecated. Please use `show.legend` instead.") + lifecycle::deprecate_warn("2.0.0", "layer(show_guide)", "layer(show.legend)") show.legend <- params$show_guide params$show_guide <- NULL } diff --git a/R/plot.r b/R/plot.r index 51f10a3187..c48bf9dc05 100644 --- a/R/plot.r +++ b/R/plot.r @@ -32,7 +32,8 @@ #' @param mapping Default list of aesthetic mappings to use for plot. #' If not specified, must be supplied in each layer added to the plot. #' @param ... Other arguments passed on to methods. Not currently used. -#' @param environment DEPRECATED. Used prior to tidy evaluation. +#' @param environment `r lifecycle::badge("deprecated")` Used prior to tidy +#' evaluation. #' @export #' @examples #' # Generate some sample data, then compute mean and standard deviation diff --git a/R/quick-plot.r b/R/quick-plot.r index 9e320f6746..111426def4 100644 --- a/R/quick-plot.r +++ b/R/quick-plot.r @@ -16,7 +16,7 @@ #' @param margins See `facet_grid()`: display marginal facets? #' @param geom Character vector specifying geom(s) to draw. Defaults to #' "point" if x and y are specified, and "histogram" if only x is specified. -#' @param stat,position DEPRECATED. +#' @param stat,position `r lifecycle::badge("deprecated")` #' @param xlim,ylim X and y axis limits #' @param log Which variables to log transform ("x", "y", or "xy") #' @param main,xlab,ylab Character vector (or expression) giving plot title, @@ -63,12 +63,12 @@ qplot <- function(x, y, ..., data, facets = NULL, margins = FALSE, geom = "auto", xlim = c(NA, NA), ylim = c(NA, NA), log = "", main = NULL, xlab = NULL, ylab = NULL, - asp = NA, stat = NULL, position = NULL) { + asp = NA, stat = deprecated(), position = deprecated()) { caller_env <- parent.frame() - if (!missing(stat)) warn("`stat` is deprecated") - if (!missing(position)) warn("`position` is deprecated") + if (lifecycle::is_present(stat)) lifecycle::deprecate_warn("2.0.0", "qplot(stat)") + if (lifecycle::is_present(position)) lifecycle::deprecate_warn("2.0.0", "qplot(position)") if (!is.character(geom)) { abort("`geom` must be a character vector") } diff --git a/R/scale-expansion.r b/R/scale-expansion.r index d094b3ebac..9e0c876f02 100644 --- a/R/scale-expansion.r +++ b/R/scale-expansion.r @@ -48,7 +48,7 @@ expansion <- function(mult = 0, add = 0) { #' @rdname expansion #' @export expand_scale <- function(mult = 0, add = 0) { - .Deprecated(msg = "`expand_scale()` is deprecated; use `expansion()` instead.") + lifecycle::deprecate_warn("3.3.0", "expand_scale()", "expansion()") expansion(mult, add) } diff --git a/R/stat-bin.r b/R/stat-bin.r index 90e7d61a3d..ae0834988c 100644 --- a/R/stat-bin.r +++ b/R/stat-bin.r @@ -103,21 +103,21 @@ StatBin <- ggproto("StatBin", Stat, } if (!is.null(params$drop)) { - warn("`drop` is deprecated. Please use `pad` instead.") + lifecycle::deprecate_warn("2.1.0", "stat_bin(drop)", "stat_bin(pad)") params$drop <- NULL } if (!is.null(params$origin)) { - warn("`origin` is deprecated. Please use `boundary` instead.") + lifecycle::deprecate_warn("2.1.0", "stat_bin(origin)", "stat_bin(boundary)") params$boundary <- params$origin params$origin <- NULL } if (!is.null(params$right)) { - warn("`right` is deprecated. Please use `closed` instead.") + lifecycle::deprecate_warn("2.1.0", "stat_bin(right)", "stat_bin(closed)") params$closed <- if (params$right) "right" else "left" params$right <- NULL } if (!is.null(params$width)) { - abort("`width` is deprecated. Do you want `geom_bar()`?") + lifecycle::deprecate_warn("2.1.0", "stat_bin(width)", "geom_bar()") } if (!is.null(params$boundary) && !is.null(params$center)) { abort("Only one of `boundary` and `center` may be specified.") diff --git a/R/stat-summary-bin.R b/R/stat-summary-bin.R index 98a13a3346..831b1866b5 100644 --- a/R/stat-summary-bin.R +++ b/R/stat-summary-bin.R @@ -16,17 +16,19 @@ stat_summary_bin <- function(mapping = NULL, data = NULL, orientation = NA, show.legend = NA, inherit.aes = TRUE, - fun.y, fun.ymin, fun.ymax) { - if (!missing(fun.y)) { - warn("`fun.y` is deprecated. Use `fun` instead.") + fun.y = deprecated(), + fun.ymin = deprecated(), + fun.ymax = deprecated()) { + if (lifecycle::is_present(fun.y)) { + lifecycle::deprecate_warn("3.3.0", "stat_summary_bin(fun.y)", "stat_summary_bin(fun)") fun = fun %||% fun.y } - if (!missing(fun.ymin)) { - warn("`fun.ymin` is deprecated. Use `fun.min` instead.") + if (lifecycle::is_present(fun.ymin)) { + lifecycle::deprecate_warn("3.3.0", "stat_summary_bin(fun.ymin)", "stat_summary_bin(fun.min)") fun.min = fun.min %||% fun.ymin } - if (!missing(fun.ymax)) { - warn("`fun.ymax` is deprecated. Use `fun.max` instead.") + if (lifecycle::is_present(fun.ymax)) { + lifecycle::deprecate_warn("3.3.0", "stat_summary_bin(fun.ymax)", "stat_summary_bin(fun.max)") fun.max = fun.max %||% fun.ymax } layer( diff --git a/R/stat-summary.r b/R/stat-summary.r index 04eaa70b5f..c7a2325d5f 100644 --- a/R/stat-summary.r +++ b/R/stat-summary.r @@ -44,8 +44,8 @@ #' @param fun.min,fun,fun.max Alternatively, supply three individual #' functions that are each passed a vector of values and should return a #' single number. -#' @param fun.ymin,fun.y,fun.ymax Deprecated, use the versions specified above -#' instead. +#' @param fun.ymin,fun.y,fun.ymax `r lifecycle::badge("deprecated")` Use the +#' versions specified above instead. #' @param fun.args Optional additional arguments passed on to the functions. #' @export #' @examples @@ -138,17 +138,19 @@ stat_summary <- function(mapping = NULL, data = NULL, orientation = NA, show.legend = NA, inherit.aes = TRUE, - fun.y, fun.ymin, fun.ymax) { - if (!missing(fun.y)) { - warn("`fun.y` is deprecated. Use `fun` instead.") + fun.y = deprecated(), + fun.ymin = deprecated(), + fun.ymax = deprecated()) { + if (lifecycle::is_present(fun.y)) { + lifecycle::deprecate_warn("3.3.0", "stat_summary(fun.y)", "stat_summary(fun)") fun = fun %||% fun.y } - if (!missing(fun.ymin)) { - warn("`fun.ymin` is deprecated. Use `fun.min` instead.") + if (lifecycle::is_present(fun.ymin)) { + lifecycle::deprecate_warn("3.3.0", "stat_summary(fun.ymin)", "stat_summary(fun.min)") fun.min = fun.min %||% fun.ymin } - if (!missing(fun.ymax)) { - warn("`fun.ymax` is deprecated. Use `fun.max` instead.") + if (lifecycle::is_present(fun.ymax)) { + lifecycle::deprecate_warn("3.3.0", "stat_summary(fun.ymax)", "stat_summary(fun.max)") fun.max = fun.max %||% fun.ymax } layer( diff --git a/R/theme.r b/R/theme.r index 267b6a8c90..9b038437c4 100644 --- a/R/theme.r +++ b/R/theme.r @@ -363,21 +363,30 @@ theme <- function(line, elements <- find_args(..., complete = NULL, validate = NULL) if (!is.null(elements$axis.ticks.margin)) { - warn("`axis.ticks.margin` is deprecated. Please set `margin` property of `axis.text` instead") + lifecycle::deprecate_warn( + "2.0.0", "theme(axis.ticks.margin)", + details = "Please set `margin` property of `axis.text` instead" + ) elements$axis.ticks.margin <- NULL } if (!is.null(elements$panel.margin)) { - warn("`panel.margin` is deprecated. Please use `panel.spacing` property instead") + lifecycle::deprecate_warn( + "2.2.0", "theme(panel.margin)", "theme(panel.spacing)" + ) elements$panel.spacing <- elements$panel.margin elements$panel.margin <- NULL } if (!is.null(elements$panel.margin.x)) { - warn("`panel.margin.x` is deprecated. Please use `panel.spacing.x` property instead") + lifecycle::deprecate_warn( + "2.2.0", "theme(panel.margin.x)", "theme(panel.spacing.x)" + ) elements$panel.spacing.x <- elements$panel.margin.x elements$panel.margin.x <- NULL } if (!is.null(elements$panel.margin.y)) { - warn("`panel.margin` is deprecated. Please use `panel.spacing` property instead") + lifecycle::deprecate_warn( + "2.2.0", "theme(panel.margin.y)", "theme(panel.spacing.y)" + ) elements$panel.spacing.y <- elements$panel.margin.y elements$panel.margin.y <- NULL } From b6bd485278e029a28a423ded08966188109f502d Mon Sep 17 00:00:00 2001 From: Thomas Lin Pedersen Date: Thu, 3 Mar 2022 10:45:49 +0100 Subject: [PATCH 04/13] deprecate gg_dep --- R/utilities.r | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/R/utilities.r b/R/utilities.r index a9587d2cc5..e5a667445f 100644 --- a/R/utilities.r +++ b/R/utilities.r @@ -185,7 +185,8 @@ binned_pal <- function(palette) { #' Give a deprecation error, warning, or message, depending on version number. #' -#' This function is deprecated. +#' @description +#' `r lifecycle::badge("deprecated")` #' #' @param version The last version of ggplot2 where this function was good #' (in other words, the last version where it was not deprecated). @@ -193,6 +194,7 @@ binned_pal <- function(palette) { #' @keywords internal #' @export gg_dep <- function(version, msg) { + lifecycle::deprecate_warn("3.3.0", "gg_dep()") .Deprecated() v <- as.package_version(version) cv <- utils::packageVersion("ggplot2") From 3a9d96d69c67b23c04b22ad6d1ad732c5e9341f8 Mon Sep 17 00:00:00 2001 From: Thomas Lin Pedersen Date: Thu, 3 Mar 2022 10:46:04 +0100 Subject: [PATCH 05/13] update docs --- DESCRIPTION | 2 +- NAMESPACE | 1 + man/aes.Rd | 4 ++-- man/aes_.Rd | 6 ++++-- man/aes_auto.Rd | 2 +- man/coord_trans.Rd | 6 +++--- man/facet_wrap.Rd | 2 +- man/geom_bin_2d.Rd | 1 + man/gg_dep.Rd | 2 +- man/ggplot.Rd | 3 ++- man/ggplot2-package.Rd | 2 +- man/labeller.Rd | 6 +++--- man/qplot.Rd | 10 +++++----- man/stat_summary.Rd | 16 ++++++++-------- man/vars.Rd | 2 +- 15 files changed, 35 insertions(+), 30 deletions(-) diff --git a/DESCRIPTION b/DESCRIPTION index ecded35724..6c4bf1b897 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -169,7 +169,7 @@ Collate: 'geom-tile.r' 'geom-violin.r' 'geom-vline.r' - 'ggplot2.r' + 'ggplot2-package.R' 'grob-absolute.r' 'grob-dotstack.r' 'grob-null.r' diff --git a/NAMESPACE b/NAMESPACE index 40c0030e2a..143c78b767 100644 --- a/NAMESPACE +++ b/NAMESPACE @@ -673,6 +673,7 @@ import(rlang) import(scales) importFrom(glue,glue) importFrom(glue,glue_collapse) +importFrom(lifecycle,deprecated) importFrom(stats,setNames) importFrom(tibble,tibble) importFrom(utils,.DollarNames) diff --git a/man/aes.Rd b/man/aes.Rd index 8ef690c287..3a890f2d7f 100644 --- a/man/aes.Rd +++ b/man/aes.Rd @@ -32,11 +32,11 @@ R names to ggplot names (e.g., \code{pch} to \code{shape} and \code{cex} to \cod \section{Quasiquotation}{ -\code{aes()} is a \link[rlang:nse-defuse]{quoting function}. This means that +\code{aes()} is a \link[rlang:topic-defuse]{quoting function}. This means that its inputs are quoted to be evaluated in the context of the data. This makes it easy to work with variables from the data frame because you can name those directly. The flip side is that you have -to use \link[rlang:nse-force]{quasiquotation} to program with +to use \link[rlang:topic-inject]{quasiquotation} to program with \code{aes()}. See a tidy evaluation tutorial such as the \href{https://dplyr.tidyverse.org/articles/programming.html}{dplyr programming vignette} to learn more about these techniques. } diff --git a/man/aes_.Rd b/man/aes_.Rd index 2f46086128..d1343bfd57 100644 --- a/man/aes_.Rd +++ b/man/aes_.Rd @@ -17,6 +17,8 @@ aes_q(x, y, ...) quoted calls, strings, one-sided formulas or constants.} } \description{ +\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} + Aesthetic mappings describe how variables in the data are mapped to visual properties (aesthetics) of geoms. \code{\link[=aes]{aes()}} uses non-standard evaluation to capture the variable names. \code{aes_()} and \code{aes_string()} @@ -24,8 +26,7 @@ require you to explicitly quote the inputs either with \code{""} for \code{aes_string()}, or with \code{quote} or \code{~} for \code{aes_()}. (\code{aes_q()} is an alias to \code{aes_()}). This makes \code{aes_()} and \code{aes_string()} easy to program with. -} -\details{ + \code{aes_string()} and \code{aes_()} are particularly useful when writing functions that create plots because you can use strings or quoted names/calls to define the aesthetic mappings, rather than having to use @@ -64,3 +65,4 @@ aes_(col = as.name(var)) \seealso{ \code{\link[=aes]{aes()}} } +\keyword{internal} diff --git a/man/aes_auto.Rd b/man/aes_auto.Rd index cf98300a27..a23c480611 100644 --- a/man/aes_auto.Rd +++ b/man/aes_auto.Rd @@ -12,6 +12,6 @@ aes_auto(data = NULL, ...) \item{...}{aesthetics that need to be explicitly mapped.} } \description{ -Automatic aesthetic mapping +\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} } \keyword{internal} diff --git a/man/coord_trans.Rd b/man/coord_trans.Rd index 930284febc..2ec4c954fa 100644 --- a/man/coord_trans.Rd +++ b/man/coord_trans.Rd @@ -9,8 +9,8 @@ coord_trans( y = "identity", xlim = NULL, ylim = NULL, - limx = "DEPRECATED", - limy = "DEPRECATED", + limx = deprecated(), + limy = deprecated(), clip = "on", expand = TRUE ) @@ -22,7 +22,7 @@ coord_trans( \item{ylim}{Limits for the x and y axes.} -\item{limx, limy}{\strong{Deprecated}: use \code{xlim} and \code{ylim} instead.} +\item{limx, limy}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} use \code{xlim} and \code{ylim} instead.} \item{clip}{Should drawing be clipped to the extent of the plot panel? A setting of \code{"on"} (the default) means yes, and a setting of \code{"off"} diff --git a/man/facet_wrap.Rd b/man/facet_wrap.Rd index 88be5898fd..cfe6d1e953 100644 --- a/man/facet_wrap.Rd +++ b/man/facet_wrap.Rd @@ -12,7 +12,7 @@ facet_wrap( shrink = TRUE, labeller = "label_value", as.table = TRUE, - switch = NULL, + switch = deprecated(), drop = TRUE, dir = "h", strip.position = "top" diff --git a/man/geom_bin_2d.Rd b/man/geom_bin_2d.Rd index 131d24942f..97f6a67eb8 100644 --- a/man/geom_bin_2d.Rd +++ b/man/geom_bin_2d.Rd @@ -100,6 +100,7 @@ in the presence of overplotting. \item \strong{\code{y}} \item \code{fill} \item \code{group} +\item \code{weight} } Learn more about setting these aesthetics in \code{vignette("ggplot2-specs")}. } diff --git a/man/gg_dep.Rd b/man/gg_dep.Rd index 3a59a65785..b43f35712a 100644 --- a/man/gg_dep.Rd +++ b/man/gg_dep.Rd @@ -13,6 +13,6 @@ gg_dep(version, msg) \item{msg}{The message to print.} } \description{ -This function is deprecated. +\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} } \keyword{internal} diff --git a/man/ggplot.Rd b/man/ggplot.Rd index 301ede85bb..11740d76c1 100644 --- a/man/ggplot.Rd +++ b/man/ggplot.Rd @@ -16,7 +16,8 @@ If not specified, must be supplied in each layer added to the plot.} \item{...}{Other arguments passed on to methods. Not currently used.} -\item{environment}{DEPRECATED. Used prior to tidy evaluation.} +\item{environment}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} Used prior to tidy +evaluation.} } \description{ \code{ggplot()} initializes a ggplot object. It can be used to diff --git a/man/ggplot2-package.Rd b/man/ggplot2-package.Rd index 2503e4a66a..489e92ef89 100644 --- a/man/ggplot2-package.Rd +++ b/man/ggplot2-package.Rd @@ -1,5 +1,5 @@ % Generated by roxygen2: do not edit by hand -% Please edit documentation in R/ggplot2.r +% Please edit documentation in R/ggplot2-package.R \docType{package} \name{ggplot2-package} \alias{ggplot2} diff --git a/man/labeller.Rd b/man/labeller.Rd index 72088af40f..883fc0a4a1 100644 --- a/man/labeller.Rd +++ b/man/labeller.Rd @@ -8,7 +8,7 @@ labeller( ..., .rows = NULL, .cols = NULL, - keep.as.numeric = NULL, + keep.as.numeric = deprecated(), .multi_line = TRUE, .default = label_value ) @@ -24,8 +24,8 @@ the columns). It is passed to \code{\link[=as_labeller]{as_labeller()}}. When a margin-wide labeller is set, make sure you don't mention in \code{...} any variable belonging to the margin.} -\item{keep.as.numeric}{Deprecated. All supplied labellers and -on-labeller functions should be able to work with character +\item{keep.as.numeric}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} All supplied +labellers and on-labeller functions should be able to work with character labels.} \item{.multi_line}{Whether to display the labels of multiple diff --git a/man/qplot.Rd b/man/qplot.Rd index 70d427cc92..b4e90f8bc1 100644 --- a/man/qplot.Rd +++ b/man/qplot.Rd @@ -20,8 +20,8 @@ qplot( xlab = NULL, ylab = NULL, asp = NA, - stat = NULL, - position = NULL + stat = deprecated(), + position = deprecated() ) quickplot( @@ -39,8 +39,8 @@ quickplot( xlab = NULL, ylab = NULL, asp = NA, - stat = NULL, - position = NULL + stat = deprecated(), + position = deprecated() ) } \arguments{ @@ -67,7 +67,7 @@ x axis label, and y axis label respectively.} \item{asp}{The y/x aspect ratio} -\item{stat, position}{DEPRECATED.} +\item{stat, position}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}}} } \description{ \code{qplot()} is a shortcut designed to be familiar if you're used to base diff --git a/man/stat_summary.Rd b/man/stat_summary.Rd index cf97b6d756..1f5f6d45d2 100644 --- a/man/stat_summary.Rd +++ b/man/stat_summary.Rd @@ -23,9 +23,9 @@ stat_summary_bin( orientation = NA, show.legend = NA, inherit.aes = TRUE, - fun.y, - fun.ymin, - fun.ymax + fun.y = deprecated(), + fun.ymin = deprecated(), + fun.ymax = deprecated() ) stat_summary( @@ -43,9 +43,9 @@ stat_summary( orientation = NA, show.legend = NA, inherit.aes = TRUE, - fun.y, - fun.ymin, - fun.ymax + fun.y = deprecated(), + fun.ymin = deprecated(), + fun.ymax = deprecated() ) } \arguments{ @@ -127,8 +127,8 @@ rather than combining with them. This is most useful for helper functions that define both data and aesthetics and shouldn't inherit behaviour from the default plot specification, e.g. \code{\link[=borders]{borders()}}.} -\item{fun.ymin, fun.y, fun.ymax}{Deprecated, use the versions specified above -instead.} +\item{fun.ymin, fun.y, fun.ymax}{\ifelse{html}{\href{https://lifecycle.r-lib.org/articles/stages.html#deprecated}{\figure{lifecycle-deprecated.svg}{options: alt='[Deprecated]'}}}{\strong{[Deprecated]}} Use the +versions specified above instead.} } \description{ \code{stat_summary()} operates on unique \code{x} or \code{y}; \code{stat_summary_bin()} diff --git a/man/vars.Rd b/man/vars.Rd index 9310562346..0b8c3f110f 100644 --- a/man/vars.Rd +++ b/man/vars.Rd @@ -12,7 +12,7 @@ evaluated in the context of the data to form faceting groups. Can be named (the names are passed to a \link[=labellers]{labeller}).} } \description{ -Just like \code{\link[=aes]{aes()}}, \code{vars()} is a \link[rlang:nse-defuse]{quoting function} +Just like \code{\link[=aes]{aes()}}, \code{vars()} is a \link[rlang:topic-defuse]{quoting function} that takes inputs to be evaluated in the context of a dataset. These inputs can be: \itemize{ From f1c4c00deadc8432f5df59b94648ebe02d0c3a02 Mon Sep 17 00:00:00 2001 From: Thomas Lin Pedersen Date: Thu, 3 Mar 2022 11:13:13 +0100 Subject: [PATCH 06/13] update coc --- .github/CODE_OF_CONDUCT.md | 126 +++++++++++++++++++++++++++++++++++++ 1 file changed, 126 insertions(+) create mode 100644 .github/CODE_OF_CONDUCT.md diff --git a/.github/CODE_OF_CONDUCT.md b/.github/CODE_OF_CONDUCT.md new file mode 100644 index 0000000000..df4ca2ecc5 --- /dev/null +++ b/.github/CODE_OF_CONDUCT.md @@ -0,0 +1,126 @@ +# Contributor Covenant Code of Conduct + +## Our Pledge + +We as members, contributors, and leaders pledge to make participation in our +community a harassment-free experience for everyone, regardless of age, body +size, visible or invisible disability, ethnicity, sex characteristics, gender +identity and expression, level of experience, education, socio-economic status, +nationality, personal appearance, race, caste, color, religion, or sexual +identity and orientation. + +We pledge to act and interact in ways that contribute to an open, welcoming, +diverse, inclusive, and healthy community. + +## Our Standards + +Examples of behavior that contributes to a positive environment for our +community include: + +* Demonstrating empathy and kindness toward other people +* Being respectful of differing opinions, viewpoints, and experiences +* Giving and gracefully accepting constructive feedback +* Accepting responsibility and apologizing to those affected by our mistakes, + and learning from the experience +* Focusing on what is best not just for us as individuals, but for the overall + community + +Examples of unacceptable behavior include: + +* The use of sexualized language or imagery, and sexual attention or advances of + any kind +* Trolling, insulting or derogatory comments, and personal or political attacks +* Public or private harassment +* Publishing others' private information, such as a physical or email address, + without their explicit permission +* Other conduct which could reasonably be considered inappropriate in a + professional setting + +## Enforcement Responsibilities + +Community leaders are responsible for clarifying and enforcing our standards of +acceptable behavior and will take appropriate and fair corrective action in +response to any behavior that they deem inappropriate, threatening, offensive, +or harmful. + +Community leaders have the right and responsibility to remove, edit, or reject +comments, commits, code, wiki edits, issues, and other contributions that are +not aligned to this Code of Conduct, and will communicate reasons for moderation +decisions when appropriate. + +## Scope + +This Code of Conduct applies within all community spaces, and also applies when +an individual is officially representing the community in public spaces. +Examples of representing our community include using an official e-mail address, +posting via an official social media account, or acting as an appointed +representative at an online or offline event. + +## Enforcement + +Instances of abusive, harassing, or otherwise unacceptable behavior may be +reported to the community leaders responsible for enforcement at codeofconduct@rstudio.com. +All complaints will be reviewed and investigated promptly and fairly. + +All community leaders are obligated to respect the privacy and security of the +reporter of any incident. + +## Enforcement Guidelines + +Community leaders will follow these Community Impact Guidelines in determining +the consequences for any action they deem in violation of this Code of Conduct: + +### 1. Correction + +**Community Impact**: Use of inappropriate language or other behavior deemed +unprofessional or unwelcome in the community. + +**Consequence**: A private, written warning from community leaders, providing +clarity around the nature of the violation and an explanation of why the +behavior was inappropriate. A public apology may be requested. + +### 2. Warning + +**Community Impact**: A violation through a single incident or series of +actions. + +**Consequence**: A warning with consequences for continued behavior. No +interaction with the people involved, including unsolicited interaction with +those enforcing the Code of Conduct, for a specified period of time. This +includes avoiding interactions in community spaces as well as external channels +like social media. Violating these terms may lead to a temporary or permanent +ban. + +### 3. Temporary Ban + +**Community Impact**: A serious violation of community standards, including +sustained inappropriate behavior. + +**Consequence**: A temporary ban from any sort of interaction or public +communication with the community for a specified period of time. No public or +private interaction with the people involved, including unsolicited interaction +with those enforcing the Code of Conduct, is allowed during this period. +Violating these terms may lead to a permanent ban. + +### 4. Permanent Ban + +**Community Impact**: Demonstrating a pattern of violation of community +standards, including sustained inappropriate behavior, harassment of an +individual, or aggression toward or disparagement of classes of individuals. + +**Consequence**: A permanent ban from any sort of public interaction within the +community. + +## Attribution + +This Code of Conduct is adapted from the [Contributor Covenant][homepage], +version 2.1, available at +. + +Community Impact Guidelines were inspired by +[Mozilla's code of conduct enforcement ladder][https://github.com/mozilla/inclusion]. + +For answers to common questions about this code of conduct, see the FAQ at +. Translations are available at . + +[homepage]: https://www.contributor-covenant.org From 41a3462d8716cd12c7febabbeefaea570bb88c2e Mon Sep 17 00:00:00 2001 From: Thomas Lin Pedersen Date: Thu, 3 Mar 2022 12:39:49 +0100 Subject: [PATCH 07/13] Move match.arg to rlang::arg_match0 and consolidate multiple argument style somewhat --- R/bin.R | 4 ++-- R/coord-polar.r | 2 +- R/coord-sf.R | 4 ++-- R/facet-grid-.r | 4 ++-- R/facet-wrap.r | 6 +++--- R/geom-density.r | 2 +- R/geom-path.r | 2 +- R/geom-ribbon.r | 4 ++-- R/guides-axis.r | 3 +-- R/position-dodge.r | 8 ++++---- R/position-dodge2.r | 4 ++-- R/save.r | 4 ++-- R/scale-.r | 6 +++--- R/scale-brewer.r | 8 ++++---- R/stat-ydensity.r | 2 +- R/utilities-break.r | 6 +++--- man/cut_interval.Rd | 9 +-------- man/ggsf.Rd | 2 +- man/position_dodge.Rd | 8 ++++---- 19 files changed, 40 insertions(+), 48 deletions(-) diff --git a/R/bin.R b/R/bin.R index 48316de083..c357cfea95 100644 --- a/R/bin.R +++ b/R/bin.R @@ -1,7 +1,7 @@ -bins <- function(breaks, closed = c("right", "left"), +bins <- function(breaks, closed = "right", fuzz = 1e-08 * stats::median(diff(breaks))) { if (!is.numeric(breaks)) abort("`breaks` must be a numeric vector") - closed <- match.arg(closed) + closed <- arg_match0(closed, c("right", "left")) breaks <- sort(breaks) # Adapted base::hist - this protects from floating point rounding errors diff --git a/R/coord-polar.r b/R/coord-polar.r index 7f3d88a847..176e515fe6 100644 --- a/R/coord-polar.r +++ b/R/coord-polar.r @@ -59,7 +59,7 @@ #' } #' } coord_polar <- function(theta = "x", start = 0, direction = 1, clip = "on") { - theta <- match.arg(theta, c("x", "y")) + theta <- arg_match0(theta, c("x", "y")) r <- if (theta == "x") "y" else "x" ggproto(NULL, CoordPolar, diff --git a/R/coord-sf.R b/R/coord-sf.R index 8f8b79f3c8..95d3207306 100644 --- a/R/coord-sf.R +++ b/R/coord-sf.R @@ -656,7 +656,7 @@ coord_sf <- function(xlim = NULL, ylim = NULL, expand = TRUE, crs = NULL, default_crs = NULL, datum = sf::st_crs(4326), label_graticule = waiver(), - label_axes = waiver(), lims_method = c("cross", "box", "orthogonal", "geometry_bbox"), + label_axes = waiver(), lims_method = "cross", ndiscr = 100, default = FALSE, clip = "on") { if (is.waive(label_graticule) && is.waive(label_axes)) { @@ -688,7 +688,7 @@ coord_sf <- function(xlim = NULL, ylim = NULL, expand = TRUE, if (is.null(default_crs) && is_missing(lims_method)) { lims_method <- "orthogonal" } else { - lims_method <- match.arg(lims_method) + lims_method <- arg_match0(lims_method, c("cross", "box", "orthogonal", "geometry_bbox")) } ggproto(NULL, CoordSf, diff --git a/R/facet-grid-.r b/R/facet-grid-.r index a31ba9bb2f..bff7477a20 100644 --- a/R/facet-grid-.r +++ b/R/facet-grid-.r @@ -123,13 +123,13 @@ facet_grid <- function(rows = NULL, cols = NULL, scales = "fixed", cols <- NULL } - scales <- match.arg(scales, c("fixed", "free_x", "free_y", "free")) + scales <- arg_match0(scales, c("fixed", "free_x", "free_y", "free")) free <- list( x = any(scales %in% c("free_x", "free")), y = any(scales %in% c("free_y", "free")) ) - space <- match.arg(space, c("fixed", "free_x", "free_y", "free")) + space <- arg_match0(space, c("fixed", "free_x", "free_y", "free")) space_free <- list( x = any(space %in% c("free_x", "free")), y = any(space %in% c("free_y", "free")) diff --git a/R/facet-wrap.r b/R/facet-wrap.r index aef5b56095..8381c0c2fc 100644 --- a/R/facet-wrap.r +++ b/R/facet-wrap.r @@ -81,8 +81,8 @@ facet_wrap <- function(facets, nrow = NULL, ncol = NULL, scales = "fixed", shrink = TRUE, labeller = "label_value", as.table = TRUE, switch = deprecated(), drop = TRUE, dir = "h", strip.position = 'top') { - scales <- match.arg(scales, c("fixed", "free_x", "free_y", "free")) - dir <- match.arg(dir, c("h", "v")) + scales <- arg_match0(scales, c("fixed", "free_x", "free_y", "free")) + dir <- arg_match0(dir, c("h", "v")) free <- list( x = any(scales %in% c("free_x", "free")), y = any(scales %in% c("free_y", "free")) @@ -98,7 +98,7 @@ facet_wrap <- function(facets, nrow = NULL, ncol = NULL, scales = "fixed", lifecycle::deprecate_warn("2.2.0", "facet_wrap(switch)", "facet_wrap(strip.position)") strip.position <- if (switch == "x") "bottom" else "left" } - strip.position <- match.arg(strip.position, c("top", "bottom", "left", "right")) + strip.position <- arg_match0(strip.position, c("top", "bottom", "left", "right")) if (identical(dir, "v")) { # swap nrow_swap <- ncol diff --git a/R/geom-density.r b/R/geom-density.r index 1f9a397a48..9bd3fc320f 100644 --- a/R/geom-density.r +++ b/R/geom-density.r @@ -59,7 +59,7 @@ geom_density <- function(mapping = NULL, data = NULL, show.legend = NA, inherit.aes = TRUE, outline.type = "upper") { - outline.type <- match.arg(outline.type, c("both", "upper", "lower", "full")) + outline.type <- arg_match0(outline.type, c("both", "upper", "lower", "full")) layer( data = data, diff --git a/R/geom-path.r b/R/geom-path.r index 6fb8013985..e1bcce2fd1 100644 --- a/R/geom-path.r +++ b/R/geom-path.r @@ -318,7 +318,7 @@ GeomStep <- ggproto("GeomStep", GeomPath, #' #' @noRd stairstep <- function(data, direction = "hv") { - direction <- match.arg(direction, c("hv", "vh", "mid")) + direction <- arg_match0(direction, c("hv", "vh", "mid")) data <- as.data.frame(data)[order(data$x), ] n <- nrow(data) diff --git a/R/geom-ribbon.r b/R/geom-ribbon.r index 8e7bd29570..b5f8a993f6 100644 --- a/R/geom-ribbon.r +++ b/R/geom-ribbon.r @@ -49,7 +49,7 @@ geom_ribbon <- function(mapping = NULL, data = NULL, show.legend = NA, inherit.aes = TRUE, outline.type = "both") { - outline.type <- match.arg(outline.type, c("both", "upper", "lower", "full")) + outline.type <- arg_match0(outline.type, c("both", "upper", "lower", "full")) layer( data = data, @@ -204,7 +204,7 @@ geom_area <- function(mapping = NULL, data = NULL, stat = "identity", position = "stack", na.rm = FALSE, orientation = NA, show.legend = NA, inherit.aes = TRUE, ..., outline.type = "upper") { - outline.type <- match.arg(outline.type, c("both", "upper", "lower", "full")) + outline.type <- arg_match0(outline.type, c("both", "upper", "lower", "full")) layer( data = data, diff --git a/R/guides-axis.r b/R/guides-axis.r index ce2ad85122..07b4da19a9 100644 --- a/R/guides-axis.r +++ b/R/guides-axis.r @@ -167,8 +167,7 @@ guide_gengrob.axis <- function(guide, theme) { #' draw_axis <- function(break_positions, break_labels, axis_position, theme, check.overlap = FALSE, angle = NULL, n.dodge = 1) { - - axis_position <- match.arg(axis_position, c("top", "bottom", "right", "left")) + axis_position <- arg_match0(axis_position, c("top", "bottom", "right", "left")) aesthetic <- if (axis_position %in% c("top", "bottom")) "x" else "y" # resolve elements diff --git a/R/position-dodge.r b/R/position-dodge.r index 9ee93a35f4..41c652cb6d 100644 --- a/R/position-dodge.r +++ b/R/position-dodge.r @@ -11,8 +11,8 @@ #' @param width Dodging width, when different to the width of the individual #' elements. This is useful when you want to align narrow geoms with wider #' geoms. See the examples. -#' @param preserve Should dodging preserve the total width of all elements -#' at a position, or the width of a single element? +#' @param preserve Should dodging preserve the `"total"` width of all elements +#' at a position, or the width of a `"single"` element? #' @family position adjustments #' @export #' @examples @@ -79,10 +79,10 @@ #' #' ggplot(mtcars, aes(factor(cyl), fill = factor(vs))) + #' geom_bar(position = position_dodge2(preserve = "total")) -position_dodge <- function(width = NULL, preserve = c("total", "single")) { +position_dodge <- function(width = NULL, preserve = "total") { ggproto(NULL, PositionDodge, width = width, - preserve = match.arg(preserve) + preserve = arg_match0(preserve, c("total", "single")) ) } diff --git a/R/position-dodge2.r b/R/position-dodge2.r index 4f27cb7676..c44a41b854 100644 --- a/R/position-dodge2.r +++ b/R/position-dodge2.r @@ -4,11 +4,11 @@ #' shrunk by this proportion to allow space between them. Defaults to 0.1. #' @param reverse If `TRUE`, will reverse the default stacking order. #' This is useful if you're rotating both the plot and legend. -position_dodge2 <- function(width = NULL, preserve = c("total", "single"), +position_dodge2 <- function(width = NULL, preserve = "total", padding = 0.1, reverse = FALSE) { ggproto(NULL, PositionDodge2, width = width, - preserve = match.arg(preserve), + preserve = arg_match0(preserve, c("total", "single")), padding = padding, reverse = reverse ) diff --git a/R/save.r b/R/save.r index 0a5738f22f..d12d334d0d 100644 --- a/R/save.r +++ b/R/save.r @@ -122,10 +122,10 @@ parse_dpi <- function(dpi) { } } -plot_dim <- function(dim = c(NA, NA), scale = 1, units = c("in", "cm", "mm", "px"), +plot_dim <- function(dim = c(NA, NA), scale = 1, units = "in", limitsize = TRUE, dpi = 300) { - units <- match.arg(units) + units <- arg_match0(units, c("in", "cm", "mm", "px")) to_inches <- function(x) x / c(`in` = 1, cm = 2.54, mm = 2.54 * 10, px = dpi)[units] from_inches <- function(x) x * c(`in` = 1, cm = 2.54, mm = 2.54 * 10, px = dpi)[units] diff --git a/R/scale-.r b/R/scale-.r index 91c35cd35f..56d348bdc6 100644 --- a/R/scale-.r +++ b/R/scale-.r @@ -99,7 +99,7 @@ continuous_scale <- function(aesthetics, scale_name, palette, name = waiver(), check_breaks_labels(breaks, labels) - position <- match.arg(position, c("left", "right", "top", "bottom")) + position <- arg_match0(position, c("left", "right", "top", "bottom")) # If the scale is non-positional, break = NULL means removing the guide if (is.null(breaks) && all(!is_position_aes(aesthetics))) { @@ -200,7 +200,7 @@ discrete_scale <- function(aesthetics, scale_name, palette, name = waiver(), ) } - position <- match.arg(position, c("left", "right", "top", "bottom")) + position <- arg_match0(position, c("left", "right", "top", "bottom")) # If the scale is non-positional, break = NULL means removing the guide if (is.null(breaks) && all(!is_position_aes(aesthetics))) { @@ -255,7 +255,7 @@ binned_scale <- function(aesthetics, scale_name, palette, name = waiver(), check_breaks_labels(breaks, labels) - position <- match.arg(position, c("left", "right", "top", "bottom")) + position <- arg_match0(position, c("left", "right", "top", "bottom")) if (is.null(breaks) && !is_position_aes(aesthetics) && guide != "none") { guide <- "none" diff --git a/R/scale-brewer.r b/R/scale-brewer.r index 9b87429365..f54396ca3f 100644 --- a/R/scale-brewer.r +++ b/R/scale-brewer.r @@ -91,7 +91,7 @@ scale_fill_brewer <- function(..., type = "seq", palette = 1, direction = 1, aes #' @rdname scale_brewer scale_colour_distiller <- function(..., type = "seq", palette = 1, direction = -1, values = NULL, space = "Lab", na.value = "grey50", guide = "colourbar", aesthetics = "colour") { # warn about using a qualitative brewer palette to generate the gradient - type <- match.arg(type, c("seq", "div", "qual")) + type <- arg_match0(type, c("seq", "div", "qual")) if (type == "qual") { warn("Using a discrete colour palette in a continuous scale.\n Consider using type = \"seq\" or type = \"div\" instead") } @@ -104,7 +104,7 @@ scale_colour_distiller <- function(..., type = "seq", palette = 1, direction = - #' @export #' @rdname scale_brewer scale_fill_distiller <- function(..., type = "seq", palette = 1, direction = -1, values = NULL, space = "Lab", na.value = "grey50", guide = "colourbar", aesthetics = "fill") { - type <- match.arg(type, c("seq", "div", "qual")) + type <- arg_match0(type, c("seq", "div", "qual")) if (type == "qual") { warn("Using a discrete colour palette in a continuous scale.\n Consider using type = \"seq\" or type = \"div\" instead") } @@ -116,7 +116,7 @@ scale_fill_distiller <- function(..., type = "seq", palette = 1, direction = -1, #' @rdname scale_brewer scale_colour_fermenter <- function(..., type = "seq", palette = 1, direction = -1, na.value = "grey50", guide = "coloursteps", aesthetics = "colour") { # warn about using a qualitative brewer palette to generate the gradient - type <- match.arg(type, c("seq", "div", "qual")) + type <- arg_match0(type, c("seq", "div", "qual")) if (type == "qual") { warn("Using a discrete colour palette in a binned scale.\n Consider using type = \"seq\" or type = \"div\" instead") } @@ -126,7 +126,7 @@ scale_colour_fermenter <- function(..., type = "seq", palette = 1, direction = - #' @export #' @rdname scale_brewer scale_fill_fermenter <- function(..., type = "seq", palette = 1, direction = -1, na.value = "grey50", guide = "coloursteps", aesthetics = "fill") { - type <- match.arg(type, c("seq", "div", "qual")) + type <- arg_match0(type, c("seq", "div", "qual")) if (type == "qual") { warn("Using a discrete colour palette in a binned scale.\n Consider using type = \"seq\" or type = \"div\" instead") } diff --git a/R/stat-ydensity.r b/R/stat-ydensity.r index e5821ebf06..6f95f98b0d 100644 --- a/R/stat-ydensity.r +++ b/R/stat-ydensity.r @@ -30,7 +30,7 @@ stat_ydensity <- function(mapping = NULL, data = NULL, orientation = NA, show.legend = NA, inherit.aes = TRUE) { - scale <- match.arg(scale, c("area", "count", "width")) + scale <- arg_match0(scale, c("area", "count", "width")) layer( data = data, diff --git a/R/utilities-break.r b/R/utilities-break.r index 0dd048a5ce..8134e66524 100644 --- a/R/utilities-break.r +++ b/R/utilities-break.r @@ -47,11 +47,11 @@ cut_number <- function(x, n = NULL, ...) { #' `boundary = 0.5`. #' @param closed One of `"right"` or `"left"` indicating whether right #' or left edges of bins are included in the bin. -cut_width <- function(x, width, center = NULL, boundary = NULL, closed = c("right", "left"), ...) { +cut_width <- function(x, width, center = NULL, boundary = NULL, closed = "right", ...) { x <- as.numeric(x) width <- as.numeric(width) - closed <- match.arg(closed) + closed <- arg_match0(closed, c("right", "left")) x_range <- range(x, na.rm = TRUE, finite = TRUE) if (length(x_range) == 0) { @@ -91,7 +91,7 @@ find_origin <- function(x_range, width, boundary) { } breaks <- function(x, equal, nbins = NULL, binwidth = NULL) { - equal <- match.arg(equal, c("numbers", "width")) + equal <- arg_match0(equal, c("numbers", "width")) if ((!is.null(nbins) && !is.null(binwidth)) || (is.null(nbins) && is.null(binwidth))) { abort("Specify exactly one of n and width") } diff --git a/man/cut_interval.Rd b/man/cut_interval.Rd index 00a67867dd..c43eb1e2ea 100644 --- a/man/cut_interval.Rd +++ b/man/cut_interval.Rd @@ -10,14 +10,7 @@ cut_interval(x, n = NULL, length = NULL, ...) cut_number(x, n = NULL, ...) -cut_width( - x, - width, - center = NULL, - boundary = NULL, - closed = c("right", "left"), - ... -) +cut_width(x, width, center = NULL, boundary = NULL, closed = "right", ...) } \arguments{ \item{x}{numeric vector} diff --git a/man/ggsf.Rd b/man/ggsf.Rd index 2e62839852..3f90c6619c 100644 --- a/man/ggsf.Rd +++ b/man/ggsf.Rd @@ -22,7 +22,7 @@ coord_sf( datum = sf::st_crs(4326), label_graticule = waiver(), label_axes = waiver(), - lims_method = c("cross", "box", "orthogonal", "geometry_bbox"), + lims_method = "cross", ndiscr = 100, default = FALSE, clip = "on" diff --git a/man/position_dodge.Rd b/man/position_dodge.Rd index 2858e9f6a0..57fce6a105 100644 --- a/man/position_dodge.Rd +++ b/man/position_dodge.Rd @@ -5,11 +5,11 @@ \alias{position_dodge2} \title{Dodge overlapping objects side-to-side} \usage{ -position_dodge(width = NULL, preserve = c("total", "single")) +position_dodge(width = NULL, preserve = "total") position_dodge2( width = NULL, - preserve = c("total", "single"), + preserve = "total", padding = 0.1, reverse = FALSE ) @@ -19,8 +19,8 @@ position_dodge2( elements. This is useful when you want to align narrow geoms with wider geoms. See the examples.} -\item{preserve}{Should dodging preserve the total width of all elements -at a position, or the width of a single element?} +\item{preserve}{Should dodging preserve the \code{"total"} width of all elements +at a position, or the width of a \code{"single"} element?} \item{padding}{Padding between elements at the same position. Elements are shrunk by this proportion to allow space between them. Defaults to 0.1.} From 6bdbc2ede8429b2c1a8a2c4b909f55e74c8e8be6 Mon Sep 17 00:00:00 2001 From: Thomas Lin Pedersen Date: Thu, 3 Mar 2022 13:05:58 +0100 Subject: [PATCH 08/13] adding lifecycle badges --- man/figures/lifecycle-archived.svg | 1 + man/figures/lifecycle-defunct.svg | 1 + man/figures/lifecycle-deprecated.svg | 1 + man/figures/lifecycle-experimental.svg | 1 + man/figures/lifecycle-maturing.svg | 1 + man/figures/lifecycle-questioning.svg | 1 + man/figures/lifecycle-stable.svg | 1 + man/figures/lifecycle-superseded.svg | 1 + 8 files changed, 8 insertions(+) create mode 100644 man/figures/lifecycle-archived.svg create mode 100644 man/figures/lifecycle-defunct.svg create mode 100644 man/figures/lifecycle-deprecated.svg create mode 100644 man/figures/lifecycle-experimental.svg create mode 100644 man/figures/lifecycle-maturing.svg create mode 100644 man/figures/lifecycle-questioning.svg create mode 100644 man/figures/lifecycle-stable.svg create mode 100644 man/figures/lifecycle-superseded.svg diff --git a/man/figures/lifecycle-archived.svg b/man/figures/lifecycle-archived.svg new file mode 100644 index 0000000000..48f72a6f3f --- /dev/null +++ b/man/figures/lifecycle-archived.svg @@ -0,0 +1 @@ + lifecyclelifecyclearchivedarchived \ No newline at end of file diff --git a/man/figures/lifecycle-defunct.svg b/man/figures/lifecycle-defunct.svg new file mode 100644 index 0000000000..01452e5fb1 --- /dev/null +++ b/man/figures/lifecycle-defunct.svg @@ -0,0 +1 @@ +lifecyclelifecycledefunctdefunct \ No newline at end of file diff --git a/man/figures/lifecycle-deprecated.svg b/man/figures/lifecycle-deprecated.svg new file mode 100644 index 0000000000..4baaee01cd --- /dev/null +++ b/man/figures/lifecycle-deprecated.svg @@ -0,0 +1 @@ +lifecyclelifecycledeprecateddeprecated \ No newline at end of file diff --git a/man/figures/lifecycle-experimental.svg b/man/figures/lifecycle-experimental.svg new file mode 100644 index 0000000000..d1d060e923 --- /dev/null +++ b/man/figures/lifecycle-experimental.svg @@ -0,0 +1 @@ +lifecyclelifecycleexperimentalexperimental \ No newline at end of file diff --git a/man/figures/lifecycle-maturing.svg b/man/figures/lifecycle-maturing.svg new file mode 100644 index 0000000000..df71310144 --- /dev/null +++ b/man/figures/lifecycle-maturing.svg @@ -0,0 +1 @@ +lifecyclelifecyclematuringmaturing \ No newline at end of file diff --git a/man/figures/lifecycle-questioning.svg b/man/figures/lifecycle-questioning.svg new file mode 100644 index 0000000000..08ee0c903f --- /dev/null +++ b/man/figures/lifecycle-questioning.svg @@ -0,0 +1 @@ +lifecyclelifecyclequestioningquestioning \ No newline at end of file diff --git a/man/figures/lifecycle-stable.svg b/man/figures/lifecycle-stable.svg new file mode 100644 index 0000000000..e015dc8110 --- /dev/null +++ b/man/figures/lifecycle-stable.svg @@ -0,0 +1 @@ +lifecyclelifecyclestablestable \ No newline at end of file diff --git a/man/figures/lifecycle-superseded.svg b/man/figures/lifecycle-superseded.svg new file mode 100644 index 0000000000..75f24f5534 --- /dev/null +++ b/man/figures/lifecycle-superseded.svg @@ -0,0 +1 @@ + lifecyclelifecyclesupersededsuperseded \ No newline at end of file From ec04236816deec423faddac5784867f24f0be28e Mon Sep 17 00:00:00 2001 From: Thomas Lin Pedersen Date: Thu, 3 Mar 2022 13:07:59 +0100 Subject: [PATCH 09/13] add cli dep --- DESCRIPTION | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/DESCRIPTION b/DESCRIPTION index 6c4bf1b897..c45379a5ff 100644 --- a/DESCRIPTION +++ b/DESCRIPTION @@ -30,13 +30,14 @@ BugReports: https://github.com/tidyverse/ggplot2/issues Depends: R (>= 3.3) Imports: + cli, digest, glue, grDevices, grid, gtable (>= 0.1.1), - lifecycle, isoband, + lifecycle, MASS, mgcv, rlang (>= 0.4.10), From 5c097f4ad4ed5f29d7eb1b616d278bbf4fdeb977 Mon Sep 17 00:00:00 2001 From: Thomas Lin Pedersen Date: Fri, 4 Mar 2022 10:13:36 +0100 Subject: [PATCH 10/13] fix partial match bug after moving to arg_match0 --- R/utilities-break.r | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/R/utilities-break.r b/R/utilities-break.r index 8134e66524..49165cd583 100644 --- a/R/utilities-break.r +++ b/R/utilities-break.r @@ -28,7 +28,7 @@ cut_interval <- function(x, n = NULL, length = NULL, ...) { #' @export #' @rdname cut_interval cut_number <- function(x, n = NULL, ...) { - brk <- breaks(x, "n", n) + brk <- breaks(x, "numbers", n) if (anyDuplicated(brk)) abort(glue("Insufficient data values to produce {n} bins.")) cut(x, brk , include.lowest = TRUE, ...) From fa77064b7ff764d4e15df9872d18fb847354a0ef Mon Sep 17 00:00:00 2001 From: Thomas Lin Pedersen Date: Fri, 4 Mar 2022 10:14:03 +0100 Subject: [PATCH 11/13] Refactor .onLoad to use on_load --- R/backports.R | 2 ++ R/compat-plyr.R | 9 +++++++++ R/geom-polygon.r | 12 ++++++++++++ R/grob-null.r | 2 +- R/theme-elements.r | 9 +++++++++ R/zzz.r | 40 +++++++--------------------------------- 6 files changed, 40 insertions(+), 34 deletions(-) diff --git a/R/backports.R b/R/backports.R index c02aca855a..7dea54cd3a 100644 --- a/R/backports.R +++ b/R/backports.R @@ -15,6 +15,8 @@ if (getRversion() < 3.3) { backport_unit_methods <- function() {} } +on_load(backport_unit_methods()) + # isFALSE() is available on R (>=3.5) if (getRversion() < 3.5) { isFALSE <- function(x) is.logical(x) && length(x) == 1L && !is.na(x) && !x diff --git a/R/compat-plyr.R b/R/compat-plyr.R index 5439def0c5..55a357ca1d 100644 --- a/R/compat-plyr.R +++ b/R/compat-plyr.R @@ -338,6 +338,15 @@ rbind_dfs <- function(dfs) { ) out } + +# Info needed for rbind_dfs date/time handling +on_load({ + date <- Sys.Date() + ggplot_global$date_origin <- date - unclass(date) + time <- Sys.time() + ggplot_global$time_origin <- time - unclass(time) +}) + #' Apply function to unique subsets of a data.frame #' #' This function is akin to `plyr::ddply`. It takes a single data.frame, diff --git a/R/geom-polygon.r b/R/geom-polygon.r index 585b6e437d..74f98612f6 100644 --- a/R/geom-polygon.r +++ b/R/geom-polygon.r @@ -186,3 +186,15 @@ GeomPolygon <- ggproto("GeomPolygon", Geom, draw_key = draw_key_polygon ) +# Assigning pathGrob in .onLoad ensures that packages that subclass GeomPolygon +# do not install with error `possible error in 'pathGrob(munched$x, munched$y, ': +# unused argument (pathId = munched$group)` despite the fact that this is correct +# usage +pathGrob <- NULL +on_load( + if (getRversion() < as.numeric_version("3.6")) { + pathGrob <- function(..., pathId.lengths) { + grid::pathGrob(...) + } + } +) diff --git a/R/grob-null.r b/R/grob-null.r index 06dcb75a6d..217c5a7560 100644 --- a/R/grob-null.r +++ b/R/grob-null.r @@ -4,8 +4,8 @@ #' @export zeroGrob <- function() .zeroGrob -# Will get assigned in .onLoad() .zeroGrob <- NULL +on_load(.zeroGrob <- grob(cl = "zeroGrob", name = "NULL")) #' @export #' @method widthDetails zeroGrob diff --git a/R/theme-elements.r b/R/theme-elements.r index e31c66e04d..8c1507b5eb 100644 --- a/R/theme-elements.r +++ b/R/theme-elements.r @@ -355,6 +355,15 @@ reset_theme_settings <- function(reset_current = TRUE) { } } +# create the global variables holding all the theme settings +on_load({ + ggplot_global$theme_all_null <- theme_all_null() # cache all null theme, required by theme_grey() + ggplot_global$theme_current <- NULL # the current theme applied to plots if none is specified + ggplot_global$theme_default <- NULL # the underlying fallback default theme + ggplot_global$element_tree <- NULL # the current element tree for themes + reset_theme_settings() # sets the preceding three global variables to their actual defaults +}) + #' @rdname register_theme_elements #' @details #' The function `get_element_tree()` returns the currently active element tree. diff --git a/R/zzz.r b/R/zzz.r index d43cecc913..59799efe91 100644 --- a/R/zzz.r +++ b/R/zzz.r @@ -21,41 +21,15 @@ random_tip <- function() { sample(tips, 1) } -# Assigning pathGrob in .onLoad ensures that packages that subclass GeomPolygon -# do not install with error `possible error in 'pathGrob(munched$x, munched$y, ': -# unused argument (pathId = munched$group)` despite the fact that this is correct -# usage -pathGrob <- NULL - -.onLoad <- function(...) { - backport_unit_methods() - - if (getRversion() < as.numeric_version("3.6")) { - pathGrob <<- function(..., pathId.lengths) { - grid::pathGrob(...) - } - } - - .zeroGrob <<- grob(cl = "zeroGrob", name = "NULL") - - # create the global variables holding all the theme settings - ggplot_global$theme_all_null <- theme_all_null() # cache all null theme, required by theme_grey() - ggplot_global$theme_current <- NULL # the current theme applied to plots if none is specified - ggplot_global$theme_default <- NULL # the underlying fallback default theme - ggplot_global$element_tree <- NULL # the current element tree for themes - reset_theme_settings() # sets the preceding three global variables to their actual defaults - - # Used by rbind_dfs - date <- Sys.Date() - ggplot_global$date_origin <- date - unclass(date) - time <- Sys.time() - ggplot_global$time_origin <- time - unclass(time) - - # To avoid namespace clash with dplyr. - # It seems surprising that this hack works +# To avoid namespace clash with dplyr. +vars <- NULL +on_load( if (requireNamespace("dplyr", quietly = TRUE)) { - vars <<- dplyr::vars + vars <- dplyr::vars } +) +.onLoad <- function(...) { + run_on_load() } release_questions <- function() { From afe133ce1c027bd8b6fe0d18354e1ffe8a91fa07 Mon Sep 17 00:00:00 2001 From: Thomas Lin Pedersen Date: Fri, 4 Mar 2022 10:14:32 +0100 Subject: [PATCH 12/13] remove old coc --- CODE_OF_CONDUCT.md | 25 ------------------------- 1 file changed, 25 deletions(-) delete mode 100644 CODE_OF_CONDUCT.md diff --git a/CODE_OF_CONDUCT.md b/CODE_OF_CONDUCT.md deleted file mode 100644 index b90773c7b9..0000000000 --- a/CODE_OF_CONDUCT.md +++ /dev/null @@ -1,25 +0,0 @@ -# Contributor Code of Conduct - -As contributors and maintainers of this project, we pledge to respect all people who -contribute through reporting issues, posting feature requests, updating documentation, -submitting pull requests or patches, and other activities. - -We are committed to making participation in this project a harassment-free experience for -everyone, regardless of level of experience, gender, gender identity and expression, -sexual orientation, disability, personal appearance, body size, race, ethnicity, age, or religion. - -Examples of unacceptable behavior by participants include the use of sexual language or -imagery, derogatory comments or personal attacks, trolling, public or private harassment, -insults, or other unprofessional conduct. - -Project maintainers have the right and responsibility to remove, edit, or reject comments, -commits, code, wiki edits, issues, and other contributions that are not aligned to this -Code of Conduct. Project maintainers who do not follow the Code of Conduct may be removed -from the project team. - -Instances of abusive, harassing, or otherwise unacceptable behavior may be reported by -opening an issue, emailing the project lead (), or one of the core developers. - -This Code of Conduct is adapted from the Contributor Covenant -(http://contributor-covenant.org), version 1.0.0, available at -http://contributor-covenant.org/version/1/0/0/ From aa8090e4951ce854a39c7f03e49cb49493d63216 Mon Sep 17 00:00:00 2001 From: Thomas Lin Pedersen Date: Fri, 4 Mar 2022 10:44:00 +0100 Subject: [PATCH 13/13] update the expected warning message --- tests/testthat/test-guides.R | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/testthat/test-guides.R b/tests/testthat/test-guides.R index 7247cac8b1..c2735c2e89 100644 --- a/tests/testthat/test-guides.R +++ b/tests/testthat/test-guides.R @@ -552,7 +552,7 @@ test_that("a warning is generated when guides( = FALSE) is specified", { y = c(6, 5, 7)) # warn on guide( = FALSE) - expect_warning(g <- guides(colour = FALSE), "`guides( = FALSE)` is deprecated.", fixed = TRUE) + expect_warning(g <- guides(colour = FALSE), "The `` argument of `guides()` cannot be `FALSE`. Use \"none\" instead as of ggplot2 3.3.4.", fixed = TRUE) expect_equal(g[["colour"]], "none") # warn on scale_*(guide = FALSE)