I'm getting some very bizarre behaviour in R and I cannot figure it out for the life of me. Minimum viable example follows:
x <- c(1, 1, 6, 1)
y <- c(0, 5)
z <- c(4, 0, 0, 2, 0, 5)
x90 <- quantile(x, 0.9)
y90 <- quantile(y, 0.9)
z90 <- quantile(z, 0.9)
c(x90, y90, z90)
round(c(x90, y90, z90), 0)
The output is:
> c(x90, y90, z90)
90% 90% 90%
4.5 4.5 4.5
> round(c(x90, y90, z90), 0)
90% 90% 90%
5 4 4
Can someone tell me why 4.5 sometimes rounds to 4, but not always, please?
Some system info:
- R version: 3.6.2 (2019-12-12)
- RStudio version: 1.1.456
- Platform: i386-w64-mingw32/i386 (32-bit)