-1

I have a very small number like 1.466013e-65, I want to round it to 3 decimals left while keeping all the 0s, here is the code I used:

round(1.466013e-65,3)

this will get me 0, but I want it to be 0.000. How to do it?

Lucifer
  • 117
  • 8

1 Answers1

0

If you are fine with character, then you can do it using:-

sprintf("%.3f", round(1.466013e-65, 3))
[1] "0.000"
sm925
  • 2,648
  • 1
  • 16
  • 28