[R] Question on Round function

Christofer Bogaso bogaso.christofer at gmail.com
Thu Jan 3 18:44:42 CET 2013


I happened to see these:

> round(.5, 0)
[1] 0
> round(1.5, 0)
[1] 2
> round(2.5, 0)
[1] 2
> round(3.5, 0)
[1] 4
> round(4.5, 0)
[1] 4


What is the rule here?

Should not round(.5, 0) = 1, round(2.5, 0) = 3 etc?

Thanks and regards,




More information about the R-help mailing list