I noticed that if you are printing a vector of percentages that are on the same order of magnitude, percent()
works well in getting you three significant digits.
> library(scales)
> percent(c(0.123,0.234))
[1] "12.3%" "23.4%"
>percent(c(0.00123,0.00234))
[1] "0.123%" "0.234%"
But if your percentages are of different orders of magnitude, percent
will pick the precision that works for the largest element -- not helpful in my use case.
> percent(c(0.123,0.00234))
[1] "12.3%" "0.2%"
How can I get three significant figures for each percent when they are of different orders of magnitude?