Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions R/all-classes.R
Original file line number Diff line number Diff line change
Expand Up @@ -52,6 +52,7 @@ NULL
#' recycled into new classes.
#'
#' @name class_definitions
#' @aliases ggplot2-ggproto
#' @keywords internal
NULL

Expand Down
2 changes: 1 addition & 1 deletion R/fortify-spatial.R
Original file line number Diff line number Diff line change
Expand Up @@ -146,7 +146,7 @@ fortify.Lines <- function(model, data, ...) {
#' @method fortify Line
fortify.Line <- function(model, data, ...) {
deprecate(
"3.4.4", escalate = "warn",,
"3.4.4", escalate = "warn",
I("`fortify(<Line>)`"),
details = "Please migrate to sf."
)
Expand Down
4 changes: 3 additions & 1 deletion R/geom-hex.R
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,9 @@ GeomHex <- ggproto("GeomHex", Geom,
n <- nrow(data)
hexC <- hexbin::hexcoords(dx, dy, n = n)

hexdata <- vec_rep_each(data[c("x", "y", "radius")], times = 6L)
columns <- intersect(c("x", "y", "radius"), names(data))
hexdata <- vec_rep_each(data[columns], times = 6L)
hexdata$radius <- hexdata$radius %||% 1
hexdata$x <- hexC$x * hexdata$radius + hexdata$x
hexdata$y <- hexC$y * hexdata$radius + hexdata$y

Expand Down
2 changes: 1 addition & 1 deletion R/ggproto.R
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ ggproto <- function(`_class` = NULL, `_inherit` = NULL, ...) {
e <- new.env(parent = emptyenv())

members <- list2(...)
check_named(members, I("Members of a {.cls ggproto} object"))
check_named(members, I("Members of a {.cls ggproto} object"), type = "warn")

# R <3.1.2 will error when list2env() is given an empty list, so we need to
# check length. https://github.com/tidyverse/ggplot2/issues/1444
Expand Down
9 changes: 7 additions & 2 deletions R/utilities-checks.R
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@ check_length <- function(x, length = integer(), ..., min = 0, max = Inf,
cli::cli_abort(msg, call = call, arg = arg)
}

check_named <- function(x, arg = caller_arg(x), call = caller_env()) {
check_named <- function(x, arg = caller_arg(x), call = caller_env(), type = "abort") {
if (missing(x)) {
stop_input_type(x, "a vector", arg = arg, call = call)
}
Expand All @@ -145,7 +145,12 @@ check_named <- function(x, arg = caller_arg(x), call = caller_env()) {
if (length(msg) < 1) {
return(invisible())
}
cli::cli_abort(msg, call = call, arg = arg)
switch(
type,
# We allow for warnings due to compatibility with reverse dependencies
warn = cli::cli_warn(msg, call = call, arg = arg),
cli::cli_abort(msg, call = call, arg = arg)
)
}

#' Check graphics device capabilities
Expand Down
1 change: 1 addition & 0 deletions man/class_definitions.Rd

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

Loading