[R] R2.11.1 seq.int difference between by and length.out

Berend Hasselman bhh at xs4all.nl
Tue Apr 10 16:30:46 CEST 2012


On 10-04-2012, at 15:54, Alexander wrote:

> I am working under R2.11.1 Windows and I was wondering why there is a
> difference between
> 
> seq.int(0,1,by=0.1)[4]-0.3
> seq.int(0,1,length.out=11)[4]-0.3 
> 
> there is also the fact that
> 
> seq(0,1,by=0.1)[4]-0.3
> seq(0,1,length.out=11)[4]-0.3 
> 
> but I think this can be explained by floating precision... 

R FAQ:  http://cran.r-project.org/doc/FAQ/R-FAQ.html

7.31 Why doesn't R think these numbers are equal?


Berend



More information about the R-help mailing list