I noticed that there is an API change for labeling in the scales package, but I'm not clear on what the change should be to. For instance, using percentage formats has been the following:
But the help page for percent() has the following note:
Old interface percent() and percent_format() are retired; please use label_percent() instead.
But how do I change the code above? The following leads to an error, and it's not clear from the set of examples in the help page how it should be used within geom_text() and geom_label():
ggplot(mydf, aes(x = cats, y = perc, label = label_percent(perc))) +
geom_text()
#> Don't know how to automatically pick scale for object of type function. Defaulting to continuous.
#> Error: Aesthetics must be valid data columns. Problematic aesthetic(s): label = label_percent(perc).
#> Did you mistype the name of a data column or forget to add stat()?
Labelling functions are designed to be used with the labels argument of ggplot2 scales.
It seems to me that these new functions are not meant to be used when mapping variables to the label aesthetic since they don't take an x argument so I think the old percent() is the only way to go while using the scales package. It would be nice if they could clarify what is their design choice for this use case.