Closed
Description
When I use a function from ggplot2 in my own R package, I need to prefix it with "ggplot2::". I found that, in this case, "stage()" does not work properly!
Here is the code to reproduce the bug:
This is the original example in ggplot2. I just changed "stage" to "ggplot2::stage".
ggplot(mpg, aes(class, displ)) +
geom_violin() +
stat_summary(
aes(
y = ggplot2::stage(displ, after_stat = 8),
label = after_stat(paste(mean, "±", sd))
),
geom = "text",
fun.data = ~ round(data.frame(mean = mean(.x), sd = sd(.x)), 2)
)
Throws the following error:
Error in `stat_summary()`:
! Problem while mapping stat to aesthetics.
ℹ Error occurred in the 2nd layer.
Caused by error:
! object 'displ' not found