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

From: John Kane <jrkrideau_at_yahoo.ca>
Date: Sun, 23 Mar 2008 14:25:56 -0400 (EDT)


See the R-FAQ 7.31 Why doesn't R think these numbers are equal? for the likely reason.
--- SET Eric Brendan <ericset_at_ust.hk> wrote:

> 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
>
> ______________________________________________
> R-help_at_r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained,
> reproducible code.
>



R-help_at_r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code. Received on Sun 23 Mar 2008 - 18:29:44 GMT

Archive maintained by Robert King, hosted by the discipline of statistics at the University of Newcastle, Australia.
Archive generated by hypermail 2.2.0, at Sun 23 Mar 2008 - 18:30:23 GMT.

Mailing list information is available at https://stat.ethz.ch/mailman/listinfo/r-help. Please read the posting guide before posting to the list.

list of date sections of archive