I would like to return all numbers with 3 significant digits after the decimal, even if the third digit is zero.
For instance suppose I have
x <- 0.8579
y <- 0.21
z <- 924894.2595
Then if I do
x <- signif(x, digits=3)
y <- signif(y, digits=3)
z <- signif(z, digits=3)
I get x = 0.857 y=0.21 and z=924894
This is almost what I want. What i actually want is
x = 0.857 y=0.210 and z=924894
I have tried using
format(round(x,3), digits=3)
But doing this I get
x = 0.857 y=0.210 and z=924894.259
So now I have an issue on z, since I actually want z=924894
.
Does anyone know of an answer in between to solve my issue?