Skip to content
Prev 205610 / 398506 Next

Strange behaviour of as.integer()

On 07/01/2010 7:31 AM, Ulrich Keller wrote:
Yes, as the man page states, non-integer values are truncated towards 
zero.  Normal printing rounds them.  So .57*100, which is slightly less 
than 57, is rounded to 57 for printing, but is truncated to 56 by 
as.integer.

 > .57*100 < 57
[1] TRUE

Duncan Murdoch