formattable icon indicating copy to clipboard operation
formattable copied to clipboard

percent function of 0.185 does not work correctly for digits = 0

Open Nicolabo opened this issue 9 years ago • 1 comments

I found that rounding value does not work correctly:

E.g.

percent(0.185, digits = 0)

gives me 18 which is not correct value in terms of rounding.

Nicolabo avatar Aug 05 '16 14:08 Nicolabo

Thanks for reporting this. percent() simply accepts the internal rounding in R, which gives

> round(c(0.184, 0.185, 0.1851, 0.186), 2)
[1] 0.18 0.18 0.19 0.19

renkun-ken avatar Aug 06 '16 01:08 renkun-ken