I would like to have the output of my if
statement have two digits of precision.
I have tried using the following with no success:
options(digits=)
format(round())
formatC()
Code
x <- 30
y <- 120.00
if(x %% 5 == 0 & y >= x + 0.50){
y - x - 0.50
}else{
y
}
#> [1] 89.5
Created on 2020-08-23 by the reprex package (v0.3.0)
I would like the output for this, and future iterations with differing x and y values, to have two digits of precision 89.50
.