[R] understanding integer divide (%/%)

Jeffrey Prisbrey jprisbrey at yahoo.com
Wed Jan 3 14:20:40 CET 2007


I am confused about why the following occurs:

> version
               _                           
platform       i386-pc-mingw32             
arch           i386                        
os             mingw32                     
system         i386, mingw32               
status                                     
major          2                           
minor          4.0                         
year           2006                        
month          10                          
day            03                          
svn rev        39566                       
language       R                           
version.string R version 2.4.0 (2006-10-03)
> 1 %/% 0.1
[1] 9
> 10 %/% 1
[1] 10
> 

This effect led me into an trap when I tried to
classify a set of proportions based on the first
decimal place by integer dividing by 0.1.  Can someone
explain why this behavior occurs and give me an
insight into how to predict it?

Thanks,
-- Jeff



More information about the R-help mailing list