'remove percentage sign from scale::percent() in R

This is my code.

my_boxplot <- ggplot(mtcars,aes(x=as.factor(cyl),y=mpg)) + 
  geom_boxplot(aes(fill=cyl,color=cyl)) + xlab('Cylinders') + ylab('Miles per Gallon %')+
  scale_y_continuous(labels = function(x) scales::percent(x, accuracy = 0.01))
my_boxplot

This code shows the y-axis as percentages and I want to keep the accuracy to 2 decimal places and remove the percentage sign.

I tried this too. It only removes the percentage sign but does not set the accuracy.

scale_y_continuous(labels=function(x) paste0(x*100)) Does anybody know how to keep the accuracy to desired decimal places and remove percentage sign from percentage values? Thanks for any help!



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source