Skip to content

Commit 3914e13

Browse files
authored
Upkeep spring 2025 (#6440)
* update last upkeep field * bump required R version * replace `%>%` with `|>` * Convert some simple anonymous functions to shorthand * add ROR * bump licence year * tidy description * tidy GHA * document * exempt `cut3()` from short function form * redocument
1 parent 4330f9b commit 3914e13

25 files changed

+65
-66
lines changed

.github/workflows/test-coverage.yaml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -35,14 +35,16 @@ jobs:
3535
clean = FALSE,
3636
install_path = file.path(normalizePath(Sys.getenv("RUNNER_TEMP"), winslash = "/"), "package")
3737
)
38+
print(cov)
3839
covr::to_cobertura(cov)
3940
shell: Rscript {0}
4041

41-
- uses: codecov/codecov-action@v4
42+
- uses: codecov/codecov-action@v5
4243
with:
43-
fail_ci_if_error: ${{ github.event_name != 'pull_request' && true || false }}
44-
file: ./cobertura.xml
45-
plugin: noop
44+
# Fail if error if not on PR, or if on PR and token is given
45+
fail_ci_if_error: ${{ github.event_name != 'pull_request' || secrets.CODECOV_TOKEN }}
46+
files: ./cobertura.xml
47+
plugins: noop
4648
disable_search: true
4749
token: ${{ secrets.CODECOV_TOKEN }}
4850

DESCRIPTION

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,8 @@ Authors@R: c(
2020
comment = c(ORCID = "0000-0002-9415-4582")),
2121
person("Teun", "van den Brand", role = "aut",
2222
comment = c(ORCID = "0000-0002-9335-7468")),
23-
person("Posit, PBC", role = c("cph", "fnd"))
23+
person("Posit, PBC", role = c("cph", "fnd"),
24+
comment = c(ROR = "03wc8by49"))
2425
)
2526
Description: A system for 'declaratively' creating graphics, based on "The
2627
Grammar of Graphics". You provide the data, tell 'ggplot2' how to map
@@ -30,7 +31,7 @@ License: MIT + file LICENSE
3031
URL: https://ggplot2.tidyverse.org, https://github.com/tidyverse/ggplot2
3132
BugReports: https://github.com/tidyverse/ggplot2/issues
3233
Depends:
33-
R (>= 4.0)
34+
R (>= 4.1)
3435
Imports:
3536
cli,
3637
grDevices,
@@ -77,7 +78,7 @@ VignetteBuilder:
7778
knitr
7879
Config/Needs/website: ggtext, tidyr, forcats, tidyverse/tidytemplate
7980
Config/testthat/edition: 3
80-
Config/usethis/last-upkeep: 2024-10-24
81+
Config/usethis/last-upkeep: 2025-04-23
8182
Encoding: UTF-8
8283
LazyData: true
8384
Roxygen: list(markdown = TRUE)

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
1-
YEAR: 2024
1+
YEAR: 2025
22
COPYRIGHT HOLDER: ggplot2 core developer team

LICENSE.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
# MIT License
22

3-
Copyright (c) 2024 ggplot2 core developer team
3+
Copyright (c) 2025 ggplot2 core developer team
44

55
Permission is hereby granted, free of charge, to any person obtaining a copy
66
of this software and associated documentation files (the "Software"), to deal

R/annotation-logticks.R

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,11 +43,11 @@
4343
#' a <- ggplot(msleep, aes(bodywt, brainwt)) +
4444
#' geom_point(na.rm = TRUE) +
4545
#' scale_x_log10(
46-
#' breaks = scales::trans_breaks("log10", function(x) 10^x),
46+
#' breaks = scales::trans_breaks("log10", \(x) 10^x),
4747
#' labels = scales::trans_format("log10", scales::math_format(10^.x))
4848
#' ) +
4949
#' scale_y_log10(
50-
#' breaks = scales::trans_breaks("log10", function(x) 10^x),
50+
#' breaks = scales::trans_breaks("log10", \(x) 10^x),
5151
#' labels = scales::trans_format("log10", scales::math_format(10^.x))
5252
#' ) +
5353
#' theme_bw()

R/geom-function.R

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -65,11 +65,9 @@ GeomFunction <- ggproto("GeomFunction", GeomPath,
6565
#' geom_function(aes(colour = "t, df = 1"), fun = dt, args = list(df = 1))
6666
#'
6767
#' # Using a custom anonymous function
68-
#' base + geom_function(fun = function(x) 0.5 * exp(-abs(x)))
68+
#' base + geom_function(fun = \(x) 0.5 * exp(-abs(x)))
6969
#' # or using lambda syntax:
7070
#' # base + geom_function(fun = ~ 0.5 * exp(-abs(.x)))
71-
#' # or in R4.1.0 and above:
72-
#' # base + geom_function(fun = \(x) 0.5 * exp(-abs(x)))
7371
#' # or using a custom named function:
7472
#' # f <- function(x) 0.5 * exp(-abs(x))
7573
#' # base + geom_function(fun = f)

R/geom-histogram.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -132,7 +132,7 @@
132132
#' # different ranges because the function will be called once per facet
133133
#' ggplot(economics_long, aes(value)) +
134134
#' facet_wrap(~variable, scales = 'free_x') +
135-
#' geom_histogram(binwidth = function(x) 2 * IQR(x) / (length(x)^(1/3)))
135+
#' geom_histogram(binwidth = \(x) 2 * IQR(x) / (length(x)^(1/3)))
136136
geom_histogram <- make_constructor(
137137
GeomBar, stat = "bin", position = "stack",
138138
# Passed to bin stat:

R/geom-map.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,7 @@ NULL
5555
#'
5656
#' crimes <- data.frame(state = tolower(rownames(USArrests)), USArrests)
5757
#'
58-
#' # Equivalent to crimes %>% tidyr::pivot_longer(Murder:Rape)
58+
#' # Equivalent to crimes |> tidyr::pivot_longer(Murder:Rape)
5959
#' vars <- lapply(names(crimes)[-1], function(j) {
6060
#' data.frame(state = crimes$state, variable = j, value = crimes[[j]])
6161
#' })

R/labeller.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,7 @@
8585
#' p + facet_grid(. ~ cyl2, labeller = label_parsed)
8686
#'
8787
#' # Include optional argument in label function
88-
#' p + facet_grid(. ~ cyl, labeller = function(x) label_both(x, sep = "="))
88+
#' p + facet_grid(. ~ cyl, labeller = \(x) label_both(x, sep = "="))
8989
#' }
9090
#' @name labellers
9191
NULL

R/stat-summary-2d.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -99,7 +99,7 @@ StatSummary2d <- ggproto(
9999
#' d + stat_summary_2d()
100100
#'
101101
#' # Specifying function
102-
#' d + stat_summary_2d(fun = function(x) sum(x^2))
102+
#' d + stat_summary_2d(fun = \(x) sum(x^2))
103103
#' d + stat_summary_2d(fun = ~ sum(.x^2))
104104
#' d + stat_summary_2d(fun = var)
105105
#' d + stat_summary_2d(fun = "quantile", fun.args = list(probs = 0.1))

R/utilities-tidy-eval.R

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -23,8 +23,8 @@
2323
#'
2424
#' ```
2525
#' my_function <- function(data, var, ...) {
26-
#' data %>%
27-
#' group_by(...) %>%
26+
#' data |>
27+
#' group_by(...) |>
2828
#' summarise(mean = mean({{ var }}))
2929
#' }
3030
#' ```
@@ -43,8 +43,8 @@
4343
#' dots <- enquos(...)
4444
#'
4545
#' # Inject
46-
#' data %>%
47-
#' group_by(!!!dots) %>%
46+
#' data |>
47+
#' group_by(!!!dots) |>
4848
#' summarise(mean = mean(!!var))
4949
#' }
5050
#' ```
@@ -60,7 +60,7 @@
6060
#'
6161
#' ```
6262
#' my_var <- "disp"
63-
#' mtcars %>% summarise(mean = mean(.data[[my_var]]))
63+
#' mtcars |> summarise(mean = mean(.data[[my_var]]))
6464
#' ```
6565
#'
6666
#' * Another tidy eval operator is `:=`. It makes it possible to use
@@ -72,7 +72,7 @@
7272
#' my_function <- function(data, var, suffix = "foo") {
7373
#' # Use `{{` to tunnel function arguments and the usual glue
7474
#' # operator `{` to interpolate plain strings.
75-
#' data %>%
75+
#' data |>
7676
#' summarise("{{ var }}_mean_{suffix}" := mean({{ var }}))
7777
#' }
7878
#' ```
@@ -87,7 +87,7 @@
8787
#' my_function <- function(data, var, suffix = "foo") {
8888
#' var <- enquo(var)
8989
#' prefix <- as_label(var)
90-
#' data %>%
90+
#' data |>
9191
#' summarise("{prefix}_mean_{suffix}" := mean(!!var))
9292
#' }
9393
#' ```

man/annotation_logticks.Rd

Lines changed: 2 additions & 2 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/geom_function.Rd

Lines changed: 1 addition & 3 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/geom_histogram.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/geom_map.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/ggplot2-package.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/labellers.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/stat_summary_2d.Rd

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

man/tidyeval.Rd

Lines changed: 7 additions & 7 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

tests/testthat/test-facet-.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -230,7 +230,7 @@ test_that("facet variables", {
230230
test_that("facet gives clear error if ", {
231231
df <- data_frame(x = 1)
232232
expect_snapshot_error(print(ggplot(df, aes(x)) + facet_grid(x ~ x)))
233-
expect_snapshot_error(print(ggplot(df, aes(x)) %>% facet_grid(. ~ x)))
233+
expect_snapshot_error(print(ggplot(df, aes(x)) |> facet_grid(. ~ x)))
234234
expect_snapshot_error(print(ggplot(df, aes(x)) + facet_grid(list(1, 2, 3))))
235235
expect_snapshot_error(print(ggplot(df, aes(x)) + facet_grid(vars(x), "free")))
236236
})

tests/testthat/test-stat-bin.R

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ test_that("fuzzy breaks are used when cutting", {
7373
p <- ggplot(df, aes(x)) +
7474
geom_histogram(binwidth = 0.1, boundary = 0.1, closed = "left")
7575

76-
bins <- get_layer_data(p) %>% subset(count > 0) %>% .[1:5]
76+
bins <- get_layer_data(p) |> subset(count > 0) |> head(5)
7777
expect_equal(bins$count, c(1, 1, 1, 1))
7878
})
7979

vignettes/articles/faq-annotation.Rmd

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -142,8 +142,8 @@ Note that we expanded the y axis limit to get the numbers to fit on the plot.
142142
```{r}
143143
#| fig.alt: "A bar chart showing the number of cars for each of three types
144144
#| of drive train. The count values are displayed on top of the bars as text."
145-
mpg %>%
146-
dplyr::count(drv) %>%
145+
mpg |>
146+
dplyr::count(drv) |>
147147
ggplot(aes(x = drv, y = n)) +
148148
geom_col() +
149149
geom_text(aes(label = n), vjust = -0.5) +
@@ -184,7 +184,7 @@ ggplot(mpg, aes(x = class, fill = drv)) +
184184
You can first calculate the counts for each segment with `dplyr::count()`, which will place these values in a column called `n`.
185185

186186
```{r}
187-
mpg %>%
187+
mpg |>
188188
count(class, drv)
189189
```
190190

@@ -195,8 +195,8 @@ You can then pass this result directly to `ggplot()`, draw the segments with app
195195
#| types of cars. The fill colour of the bars indicate the type of drive
196196
#| train. In the middle of each filled part, the count value is displayed as
197197
#| text."
198-
mpg %>%
199-
count(class, drv) %>%
198+
mpg |>
199+
count(class, drv) |>
200200
ggplot(aes(x = class, fill = drv, y = n)) +
201201
geom_col() +
202202
geom_text(aes(label = n), size = 3, position = position_stack(vjust = 0.5))
@@ -226,9 +226,9 @@ One option is to calculate the proportions with `dplyr::count()` and then use `g
226226
```{r}
227227
#| fig.alt: "A bar chart showing the proportion of cars for each of three types
228228
#| of drive train."
229-
mpg %>%
230-
dplyr::count(drv) %>%
231-
mutate(prop = n / sum(n)) %>%
229+
mpg |>
230+
dplyr::count(drv) |>
231+
mutate(prop = n / sum(n)) |>
232232
ggplot(aes(x = drv, y = prop)) +
233233
geom_col()
234234
```

vignettes/articles/faq-bars.Rmd

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -258,7 +258,7 @@ poll <- tribble(
258258
You can first pivot the data longer to obtain a data frame with one row per party/opinion combination and a new column, `n`, for the number of responses that fall into that category.
259259

260260
```{r}
261-
poll_longer <- poll %>%
261+
poll_longer <- poll |>
262262
pivot_longer(
263263
cols = -party,
264264
names_to = "opinion",
@@ -318,12 +318,12 @@ Then, pass the resulting longer data frame to `ggplot()` group responses for eac
318318
#| fig.alt: "A grouped bar chart showing the number of responses to three
319319
#| questions. Within each question, two bars denote an 'Agree' or 'Disagree'
320320
#| response."
321-
survey %>%
321+
survey |>
322322
tidyr::pivot_longer(
323323
cols = -respondent,
324324
names_to = "question",
325325
values_to = "response"
326-
) %>%
326+
) |>
327327
ggplot(aes(x = question, fill = response)) +
328328
geom_bar(position = "dodge")
329329
```
@@ -344,9 +344,9 @@ Then, you can pass the resulting data frame to `ggplot()` and plot bars using `g
344344
```{r}
345345
#| fig.alt: "A bar chart showing the average highway miles per gallon for
346346
#| three types of drive train."
347-
mpg %>%
348-
group_by(drv) %>%
349-
summarise(mean_hwy = mean(hwy)) %>%
347+
mpg |>
348+
group_by(drv) |>
349+
summarise(mean_hwy = mean(hwy)) |>
350350
ggplot(aes(x = drv, y = mean_hwy)) +
351351
geom_col()
352352
```

0 commit comments

Comments
 (0)