library(SPARTAAS)
x1 <- c(15,25,35,45,55)
round(x1,-1)
arrondi(x1,-1)
x2 <- c(-15,-25,-35,-45,-55)
round(x2,-1)
arrondi(x2, -1)
x3 <- 1.125
round(x3,2)
arrondi(x3, 2)
x4 <- seq(-0.55,0.55,0.1)
data.frame(
val = x4,
round = round(x4,1),
arrondi = arrondi(x4, 1),
equal = (arrondi(x4, 1) == round(x4,1))
)
Run the code above in your browser using DataLab