Skip to content

Commit 859713a

Browse files
authored
Merge pull request #3366 from tidyverse/v3.2.0-rc
2 parents b560662 + 548e7d0 commit 859713a

23 files changed

+15526
-263
lines changed

.Rbuildignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,3 +25,4 @@ visual_test
2525
^appveyor\.yml$
2626
^\.github$
2727
^vignettes/profilings
28+
^cran-comments\.md$

.travis.yml

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,11 @@ matrix:
1818
provider: script
1919
script: Rscript -e 'pkgdown::deploy_site_github(verbose = TRUE)'
2020
skip_cleanup: true
21-
- r: oldrel
21+
- r: 3.5
22+
- r: 3.4
23+
- r: 3.3
2224
- r: 3.2
2325
env: R_REMOTES_NO_ERRORS_FROM_WARNINGS=true
24-
- r: 3.1
25-
env: R_REMOTES_NO_ERRORS_FROM_WARNINGS=true
2626

2727
# environment variables set for all builds
2828
env:

DESCRIPTION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ Authors@R: c(
1717
person("RStudio", role = c("cph"))
1818
)
1919
Depends:
20-
R (>= 3.1)
20+
R (>= 3.2)
2121
Imports:
2222
digest,
2323
grDevices,

NEWS.md

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
(i.e., `slope`, `intercept`, `yintercept`, and/or `xintercept`)
66
and mapped aesthetics (i.e., `data` and/or `mapping`).
77

8-
# ggplot2 3.1.1.9000
8+
# ggplot2 3.2.0
99

1010
This is a minor release with an emphasis on internal changes to make ggplot2
1111
faster and more consistent. The few interface changes will only affect the
@@ -14,6 +14,9 @@ extension developers if they have relied on internals that have been changed.
1414
This release also sees the addition of Hiroaki Yutani (@yutannihilation) to the
1515
core developer team.
1616

17+
With the release of R 3.6, ggplot2 now requires the R version to be at least 3.2,
18+
as the tidyverse is committed to support 5 major versions of R.
19+
1720
## Breaking changes
1821

1922
* Two patches (#2996 and #3050) fixed minor rendering problems. In most cases,

R/compat-plyr.R

Lines changed: 24 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -292,12 +292,26 @@ rbind_dfs <- function(dfs) {
292292
allocated[new_columns] <- TRUE
293293
if (all(allocated)) break
294294
}
295+
is_date <- lapply(out, inherits, 'Date')
296+
is_time <- lapply(out, inherits, 'POSIXct')
295297
pos <- c(cumsum(nrows) - nrows + 1)
296298
for (i in seq_along(dfs)) {
297299
df <- dfs[[i]]
298300
rng <- seq(pos[i], length.out = nrows[i])
299301
for (col in names(df)) {
300-
if (inherits(df[[col]], 'factor')) {
302+
date_col <- inherits(df[[col]], 'Date')
303+
time_col <- inherits(df[[col]], 'POSIXct')
304+
if (is_date[[col]] && !date_col) {
305+
out[[col]][rng] <- as.Date(
306+
unclass(df[[col]]),
307+
origin = ggplot_global$date_origin
308+
)
309+
} else if (is_time[[col]] && !time_col) {
310+
out[[col]][rng] <- as.POSIXct(
311+
unclass(df[[col]]),
312+
origin = ggplot_global$time_origin
313+
)
314+
} else if (date_col || time_col || inherits(df[[col]], 'factor')) {
301315
out[[col]][rng] <- as.character(df[[col]])
302316
} else {
303317
out[[col]][rng] <- df[[col]]
@@ -307,7 +321,11 @@ rbind_dfs <- function(dfs) {
307321
for (col in names(col_levels)) {
308322
out[[col]] <- factor(out[[col]], levels = col_levels[[col]])
309323
}
310-
attributes(out) <- list(class = "data.frame", names = names(out), row.names = .set_row_names(total))
324+
attributes(out) <- list(
325+
class = "data.frame",
326+
names = names(out),
327+
row.names = .set_row_names(total)
328+
)
311329
out
312330
}
313331
#' Apply function to unique subsets of a data.frame
@@ -333,6 +351,7 @@ dapply <- function(df, by, fun, ..., drop = TRUE) {
333351
grouping_cols <- .subset(df, by)
334352
ids <- id(grouping_cols, drop = drop)
335353
group_rows <- split(seq_len(nrow(df)), ids)
354+
fallback_order <- unique(c(by, names(df)))
336355
rbind_dfs(lapply(seq_along(group_rows), function(i) {
337356
cur_data <- df_rows(df, group_rows[[i]])
338357
res <- fun(cur_data, ...)
@@ -341,6 +360,8 @@ dapply <- function(df, by, fun, ..., drop = TRUE) {
341360
vars <- lapply(setNames(by, by), function(col) .subset2(cur_data, col)[1])
342361
if (is.matrix(res)) res <- split_matrix(res)
343362
if (is.null(names(res))) names(res) <- paste0("V", seq_along(res))
344-
new_data_frame(modify_list(unclass(vars), unclass(res)))
363+
if (all(by %in% names(res))) return(new_data_frame(unclass(res)))
364+
res <- modify_list(unclass(vars), unclass(res))
365+
new_data_frame(res[intersect(c(fallback_order, names(res)), names(res))])
345366
}))
346367
}

R/coord-map.r

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -57,18 +57,10 @@
5757
#'
5858
#' if (require("maps")) {
5959
#' # Other projections
60-
#' nzmap + coord_map("cylindrical")
61-
#' }
62-
#'
63-
#' if (require("maps")) {
6460
#' nzmap + coord_map("azequalarea", orientation = c(-36.92, 174.6, 0))
6561
#' }
6662
#'
6763
#' if (require("maps")) {
68-
#' nzmap + coord_map("lambert", parameters = c(-37, -44))
69-
#' }
70-
#'
71-
#' if (require("maps")) {
7264
#' states <- map_data("state")
7365
#' usamap <- ggplot(states, aes(long, lat, group = group)) +
7466
#' geom_polygon(fill = "white", colour = "black")
@@ -83,39 +75,27 @@
8375
#' }
8476
#'
8577
#' if (require("maps")) {
86-
#' usamap + coord_quickmap()
87-
#' }
88-
#'
89-
#' if (require("maps")) {
9078
#' # See ?mapproject for coordinate systems and their parameters
9179
#' usamap + coord_map("gilbert")
9280
#' }
9381
#'
9482
#' if (require("maps")) {
95-
#' usamap + coord_map("lagrange")
96-
#' }
97-
#'
98-
#' if (require("maps")) {
9983
#' # For most projections, you'll need to set the orientation yourself
10084
#' # as the automatic selection done by mapproject is not available to
10185
#' # ggplot
10286
#' usamap + coord_map("orthographic")
10387
#' }
10488
#'
10589
#' if (require("maps")) {
106-
#' usamap + coord_map("stereographic")
107-
#' }
108-
#'
109-
#' if (require("maps")) {
11090
#' usamap + coord_map("conic", lat0 = 30)
11191
#' }
11292
#'
11393
#' if (require("maps")) {
11494
#' usamap + coord_map("bonne", lat0 = 50)
11595
#' }
11696
#'
97+
#' \dontrun{
11798
#' if (require("maps")) {
118-
#'
11999
#' # World map, using geom_path instead of geom_polygon
120100
#' world <- map_data("world")
121101
#' worldmap <- ggplot(world, aes(x = long, y = lat, group = group)) +
@@ -136,6 +116,7 @@
136116
#' # Centered on New York (currently has issues with closing polygons)
137117
#' worldmap + coord_map("ortho", orientation = c(41, -74, 0))
138118
#' }
119+
#' }
139120
coord_map <- function(projection="mercator", ..., parameters = NULL, orientation = NULL, xlim = NULL, ylim = NULL, clip = "on") {
140121
if (is.null(parameters)) {
141122
params <- list(...)

R/position-dodge.r

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,10 +17,10 @@
1717
#' ggplot(mtcars, aes(factor(cyl), fill = factor(vs))) +
1818
#' geom_bar(position = "dodge2")
1919
#'
20-
#' # By default, dodging with `position_dodge2()` preserves the width of each
21-
#' # element. You can choose to preserve the total width with:
20+
#' # By default, dodging with `position_dodge2()` preserves the total width of
21+
#' # the elements. You can choose to preserve the width of each element with:
2222
#' ggplot(mtcars, aes(factor(cyl), fill = factor(vs))) +
23-
#' geom_bar(position = position_dodge(preserve = "total"))
23+
#' geom_bar(position = position_dodge2(preserve = "single"))
2424
#'
2525
#' \donttest{
2626
#' ggplot(diamonds, aes(price, fill = cut)) +

R/zzz.r

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,12 @@ pathGrob <- NULL
3535

3636
ggplot_global$theme_current <- theme_gray()
3737

38+
# Used by rbind_dfs
39+
date <- Sys.Date()
40+
ggplot_global$date_origin <- date - unclass(date)
41+
time <- Sys.time()
42+
ggplot_global$time_origin <- time - unclass(time)
43+
3844
# To avoid namespace clash with dplyr.
3945
# It seems surprising that this hack works
4046
if (requireNamespace("dplyr", quietly = TRUE)) {

_pkgdown.yml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -225,6 +225,8 @@ navbar:
225225
text: News
226226
menu:
227227
- text: "Release notes"
228+
- text: "Version 3.2.0"
229+
href: https://www.tidyverse.org/articles/2019/06/ggplot2-3-2-0/
228230
- text: "Version 3.1.0"
229231
href: https://www.tidyverse.org/articles/2018/10/ggplot2-3-1-0/
230232
- text: "Version 3.0.0"

0 commit comments

Comments
 (0)