Skip to content

Merge in v3.4.4 to main #5480

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 10 commits into from
Oct 13, 2023
Merged
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
3 changes: 1 addition & 2 deletions DESCRIPTION
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
Package: ggplot2
Version: 3.4.3.9000
Version: 3.4.4.9000
Title: Create Elegant Data Visualisations Using the Grammar of Graphics
Authors@R: c(
person("Hadley", "Wickham", , "[email protected]", role = "aut",
Expand Down Expand Up @@ -54,7 +54,6 @@ Suggests:
knitr,
mapproj,
maps,
maptools,
multcomp,
munsell,
nlme,
Expand Down
11 changes: 11 additions & 0 deletions NEWS.md
Original file line number Diff line number Diff line change
Expand Up @@ -155,6 +155,17 @@
duplicated coordinates (@teunbrand, #5215).
* Improve performance of layers without positional scales (@zeehio, #4990)

# ggplot2 3.4.4

This hotfix release adapts to a change in r-devel's `base::is.atomic()` and
the upcoming retirement of maptools.

* `fortify()` for sp objects (e.g., `SpatialPolygonsDataFrame`) is now deprecated
and will be removed soon in support of [the upcoming retirement of rgdal, rgeos,
and maptools](https://r-spatial.org/r/2023/05/15/evolution4.html). In advance
of the whole removal, `fortify(<SpatialPolygonsDataFrame>, region = ...)`
no longer works as of this version (@yutannihilation, #5244).

# ggplot2 3.4.3
This hotfix release addresses a version comparison change in r-devel. There are
no user-facing or breaking changes.
Expand Down
6 changes: 3 additions & 3 deletions R/aes-evaluation.R
Original file line number Diff line number Diff line change
Expand Up @@ -226,7 +226,7 @@ is_calculated <- function(x, warn = FALSE) {
return(TRUE)
}
# Support of old recursive behaviour
if (is.atomic(x)) {
if (is.null(x) || is.atomic(x)) {
FALSE
} else if (is.symbol(x)) {
res <- is_dotted_var(as.character(x))
Expand Down Expand Up @@ -266,7 +266,7 @@ is_staged <- function(x) {

# Strip dots from expressions
strip_dots <- function(expr, env, strip_pronoun = FALSE) {
if (is.atomic(expr)) {
if (is.null(expr) || is.atomic(expr)) {
expr
} else if (is.name(expr)) {
expr_ch <- as.character(expr)
Expand Down Expand Up @@ -324,7 +324,7 @@ strip_stage <- function(expr) {
make_labels <- function(mapping) {
default_label <- function(aesthetic, mapping) {
# e.g., geom_smooth(aes(colour = "loess")) or aes(y = NULL)
if (is.atomic(mapping)) {
if (is.null(mapping) || is.atomic(mapping)) {
return(aesthetic)
}
mapping <- strip_stage(mapping)
Expand Down
2 changes: 1 addition & 1 deletion R/aes.R
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@ aes_ <- function(x, y, ...) {
as_quosure_aes <- function(x) {
if (is.formula(x) && length(x) == 2) {
as_quosure(x)
} else if (is.call(x) || is.name(x) || is.atomic(x)) {
} else if (is.null(x) || is.call(x) || is.name(x) || is.atomic(x)) {
new_aesthetic(x, caller_env)
} else {
cli::cli_abort("Aesthetic must be a one-sided formula, call, name, or constant.")
Expand Down
62 changes: 47 additions & 15 deletions R/fortify-spatial.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,32 +9,31 @@
#' @param ... not used by this method
#' @keywords internal
#' @name fortify.sp
#' @examples
#' if (require("maptools")) {
#' sids <- system.file("shapes/sids.shp", package="maptools")
#' nc1 <- readShapePoly(sids,
#' proj4string = CRS("+proj=longlat +datum=NAD27"))
#' nc1_df <- fortify(nc1)
#' }
NULL

#' @rdname fortify.sp
#' @export
#' @method fortify SpatialPolygonsDataFrame
fortify.SpatialPolygonsDataFrame <- function(model, data, region = NULL, ...) {
deprecate_warn0("3.4.4",
I("`fortify(<SpatialPolygonsDataFrame>)`"),
details = "Please migrate to sf."
)

attr <- as.data.frame(model)
# If not specified, split into regions based on polygons
if (is.null(region)) {
coords <- lapply(model@polygons,fortify)
# Suppress duplicated warnings
withr::with_options(list(lifecycle_verbosity = "quiet"), {
coords <- lapply(model@polygons,fortify)
})
coords <- vec_rbind0(!!!coords)
cli::cli_inform("Regions defined for each Polygons")
} else {
cp <- sp::polygons(model)

# Union together all polygons that make up a region
unioned <- maptools::unionSpatialPolygons(cp, attr[, region])
coords <- fortify(unioned)
coords$order <- 1:nrow(coords)
lifecycle::deprecate_stop("3.4.4",
I("`fortify(<SpatialPolygonsDataFrame>, region = ...)` is defunct'"),
details = "Please migrate to sf."
)
}
coords
}
Expand All @@ -43,14 +42,27 @@ fortify.SpatialPolygonsDataFrame <- function(model, data, region = NULL, ...) {
#' @export
#' @method fortify SpatialPolygons
fortify.SpatialPolygons <- function(model, data, ...) {
polys <- lapply(model@polygons, fortify)
deprecate_warn0("3.4.4",
I("`fortify(<SpatialPolygons>)`"),
details = "Please migrate to sf."
)

# Suppress duplicated warnings
withr::with_options(list(lifecycle_verbosity = "quiet"), {
polys <- lapply(model@polygons, fortify)
})
vec_rbind0(!!!polys)
}

#' @rdname fortify.sp
#' @export
#' @method fortify Polygons
fortify.Polygons <- function(model, data, ...) {
deprecate_warn0("3.4.4",
I("`fortify(<Polygons>)`"),
details = "Please migrate to sf."
)

subpolys <- model@Polygons
pieces <- lapply(seq_along(subpolys), function(i) {
df <- fortify(subpolys[[model@plotOrder[i]]])
Expand All @@ -70,6 +82,11 @@ fortify.Polygons <- function(model, data, ...) {
#' @export
#' @method fortify Polygon
fortify.Polygon <- function(model, data, ...) {
deprecate_warn0("3.4.4",
I("`fortify(<Polygon>)`"),
details = "Please migrate to sf."
)

df <- as.data.frame(model@coords)
names(df) <- c("long", "lat")
df$order <- 1:nrow(df)
Expand All @@ -81,6 +98,11 @@ fortify.Polygon <- function(model, data, ...) {
#' @export
#' @method fortify SpatialLinesDataFrame
fortify.SpatialLinesDataFrame <- function(model, data, ...) {
deprecate_warn0("3.4.4",
I("`fortify(<SpatialLinesDataFrame>)`"),
details = "Please migrate to sf."
)

lines <- lapply(model@lines, fortify)
vec_rbind0(!!!lines)
}
Expand All @@ -89,6 +111,11 @@ fortify.SpatialLinesDataFrame <- function(model, data, ...) {
#' @export
#' @method fortify Lines
fortify.Lines <- function(model, data, ...) {
deprecate_warn0("3.4.4",
I("`fortify(<Lines>)`"),
details = "Please migrate to sf."
)

lines <- model@Lines
pieces <- lapply(seq_along(lines), function(i) {
df <- fortify(lines[[i]])
Expand All @@ -108,6 +135,11 @@ fortify.Lines <- function(model, data, ...) {
#' @export
#' @method fortify Line
fortify.Line <- function(model, data, ...) {
deprecate_warn0("3.4.4",
I("`fortify(<Line>)`"),
details = "Please migrate to sf."
)

df <- as.data.frame(model@coords)
names(df) <- c("long", "lat")
df$order <- 1:nrow(df)
Expand Down
71 changes: 66 additions & 5 deletions cran-comments.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,66 @@
This is a patch release responding to a request from CRAN about numeric
version comparisons in R-devel. It also includes a workaround for changes
in the `stats::density()` function in R-devel that affected visual tests.
There are no user facing changes, so no reverse dependencies are expected to
be affected.
This is a patch release responding to changes in R-devel concerning the behavior
of `is.atomic()`. Further, it contains the removal of maptools and rgeos which
is set for archival soon

## revdepcheck results

We checked 4771 reverse dependencies (4716 from CRAN + 55 from Bioconductor), comparing R CMD check results across CRAN and dev versions of this package.

* We saw 2 new problems
* We failed to check 42 packages

Issues with CRAN packages are summarised below.

### New problems
(This reports the first line of each new failure)

* jfa
checking re-building of vignette outputs ... WARNING

* SCORPIUS
checking tests ... ERROR

### Failed to check

* ale (NA)
* aPEAR (NA)
* bayesdfa (NA)
* BrailleR (NA)
* CausalImpact (NA)
* CensMFM (NA)
* cinaR (NA)
* fdacluster (NA)
* genekitr (NA)
* ggPMX (NA)
* grandR (NA)
* HeckmanEM (NA)
* immcp (NA)
* loon.ggplot (NA)
* MACP (NA)
* MarketMatching (NA)
* MARVEL (NA)
* MSclassifR (NA)
* nlmixr2 (NA)
* nlmixr2extra (NA)
* nlmixr2plot (NA)
* nlmixr2rpt (NA)
* numbat (NA)
* oHMMed (NA)
* OlinkAnalyze (NA)
* OpenMx (NA)
* phylosem (NA)
* PsychWordVec (NA)
* RcppCensSpatial (NA)
* rmsb (NA)
* rstanarm (NA)
* RVA (NA)
* SCpubr (NA)
* SSVS (NA)
* streamDAG (NA)
* TestAnaAPP (NA)
* tidySEM (NA)
* tinyarray (NA)
* TOmicsVis (NA)
* valse (NA)
* vivid (NA)
* xpose.nlmixr2 (NA)
8 changes: 0 additions & 8 deletions man/fortify.sp.Rd

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

Loading