Closed
Description
Useful new feature!
Noticed the new functional way of setting labs fails when the applicable aesthetic is not present. Was wondering if it could be okay with this?
This is useful for creating wrapper functions
library(tidyverse)
library(palmerpenguins)
#>
#> Attaching package: 'palmerpenguins'
#> The following objects are masked from 'package:datasets':
#>
#> penguins, penguins_raw
#works
penguins |>
ggplot() +
geom_histogram(aes(x = flipper_length_mm)) +
labs(
x = snakecase::to_sentence_case,
y = snakecase::to_sentence_case,
)
#> `stat_bin()` using `bins = 30`. Pick better value `binwidth`.
#> Warning: Removed 2 rows containing non-finite outside the scale range
#> (`stat_bin()`).
#fails
penguins |>
ggplot() +
geom_histogram(aes(x = flipper_length_mm)) +
labs(
x = snakecase::to_sentence_case,
y = snakecase::to_sentence_case,
fill = snakecase::to_sentence_case,
)
#> Error in "lapply(text, glue_cmd, .envir = .envir)": ! Could not evaluate cli `{}` expression: ` to_any_case(st…`.
#> Caused by error in `to_any_case(string = string, case = "sentence", sep_in = sep_in, …`:
#> ! could not find function "to_any_case"
Created on 2025-05-20 with reprex v2.1.1