0

I am trying to round to the nearest hundredth so that anything above 0.05 and higher rounds up and anything below 0.05 rounds down, so for example I want 0.835 to round to 0.84. I've tried multiple functions such as plyr::round_any and functions that were shared on the page below but none of them work as I have intended.

How to round up to the nearest 10 (or 100 or X)?

x <- 0.835

round(x, digits = 2)
round_any(x, 0.01, ceiling)

AmG
  • 19
  • 5

1 Answers1

0

Your example does round 0.835 up to 0.84. You could also use round_half_up from janitor:

janitor::round_half_up(0.835, digits = 2)
[1] 0.84
LMc
  • 12,577
  • 3
  • 31
  • 43