[R] bug?
Patrick Jahn
Jahn at Mathematik.Uni-Mainz.DE
Wed Jul 26 19:47:06 CEST 2006
Dear All,
if you generate a sequence with small latitude like:
x<-seq(0,1,0.005)
and you ask for all points of this lattice how many points are in a neighbourhood with radius 0.01
of each point:
v <- rep( 0 , length( x ) ) ;
for (i in 1:length(x) )
{ v[i] <- length(x[ abs(x-x[i]) < 0.01 ] ) ; };
then the answer should be: v = (2, 3, 3, 3, 3,.......,3, 3, 3, 3, 2), because every point instead
of the borders has 3 points in a 0.01-neighbourhood.
but v contains also many 4 and also 5:
> v
[1] 2 4 3 4 4 3 4 4 3 4 4 3 4 4 4 4 5 4 4 5 4 4 5 4 4 4 3 4 4 4 4 3 3 3 4 4 4
[38] 4 3 3 4 4 4 4 3 3 4 4 4 4 3 3 3 3 3 3 4 4 4 4 3 3 3 3 3 3 3 3 3 4 4 4 4 3
[75] 3 3 3 3 3 3 3 3 4 4 4 4 3 3 3 3 3 3 3 3 4 4 4 4 3 3 3 3 3 3 3 3 3 3 3 3 3
[112] 3 3 3 4 4 4 4 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 3 3 3 3 3
[149] 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 4 4 4 4 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3 3
[186] 3 3 3 3 3 4 4 4 4 3 3 3 3 3 3 2
Could anyone explain this fact and help me to compute exactly on general data.
Thank you very much,
Patrick Jahn
More information about the R-help
mailing list