[R] Bug check (possibly in seq()). RGui 2.6.2 (2008-02-08)

SET Eric Brendan ericset at ust.hk
Sun Mar 23 18:48:15 CET 2008


Hello All,

I'm new to R, but I can't account for the results from the simple script
below and it looks simple enough.

Description: When A is generated by seq(), A[A==x] incorrectly returns
numeric(0) for some values of x (in A) but not others.

##########################
A<-seq(0,1,by=.05)

#These return numeric(0), but others in the set return the correct value
A[A==.3]
A[A==.6]
A[A==.7]
A[A==.15]
A[A==.35]
A[A==.85]
A[A==.95] #A[20]

# This works fine
B<-seq(0,1,by=.05)
A[A==B]

# This also works fine
A<-c(0,.05,.1,.15,.2,.25,.30,.35,.40,.45,
    .50,.55,.6,.65,.7,.75,.8,.85,.9,.95,1)
A[A==.3]
##########################

R, RGui 2.6.2 (2008-02-08)
Windows XP Professional SP 2
Pentium(R) D CPU 2.80GHz, 2G RAM

Hoping someone else can reproduce it.

Regards,
Eric Set



More information about the R-help mailing list