all.equal(, ) not considering names [was "vector documentation error?"]
The following is what I got from S-Plus 6.2 under Windows 2000:
> x <- c(a = 1, b = 2)
> is.vector(x)
[1] F
> as.vector(x)
[1] 1 2
> all.equal(x, as.vector(x))
[1] "target, current classes differ: named :
integer"
[2] "class of target is \"named\", class of current is \"integer\"
(coercing target to class of current)"
Thanks, Martin and all of the core R team for their exceptional
contribution to this marvelous software. I think it provides a great
liberating force to all research that includes the development of new
statistical algorithms by making it so much easier for others to modify
and extend something that previous researchers have developed.
Best Wishes,
spencer graves
Martin Maechler wrote:
"Spencer" == Spencer Graves <spencer.graves@pdf.com>
on Wed, 21 Jul 2004 05:47:01 -0700 writes:
Spencer> The help file for "vector" in R 1.9.1 for Windows includes the
Spencer> following:
Spencer> x <- c(a = 1, b = 2)
Spencer> is.vector(x)
Spencer> as.vector(x)
Spencer> all.equal(x, as.vector(x)) ## FALSE
Spencer> I ran this just now and got TRUE.
yes, I get this as well {R-patched on Linux}.
I'm sure that it never returned FALSE, since all.equal()
doesn't ever. However it *did* give non TRUE
in R versions up to 1.6.2 :
> x <- c(a=1,b=2); all.equal(x, as.vector(x))
[1] "names for target but not for current" "TRUE" and it does give something similar in the our S-plus 6.1 version. Our documentation does nowhere specify what should happen exactly in this case, but I do doubt that the current behavior is correct. What do other (long time S language) users think? Spencer> Should I bother to report such things? yes, please, in any case! Spencer> If yes, to whom? As long as you have a "?" going with it, it's not something you should report as bug. In that case, you decide between R-help or R-devel and the posting guide has a paragraph on this. I think you decided very well for the current topic. <....> Spencer> p.s. Please excuse if I'm sending this to the Spencer> wrong address. I went to www.r-project.org -> Spencer> Mailing Lists and double clicked on an apparent hot Spencer> link to "r-bugs" and got nothing <....> Well, R-bugs is *not* a mailing list. You'll find its address in other places such as the R-FAQ or help(bug.report). Spencer> Therefore, I decided to send this to r-devel. The "therefore" wasn't quite correct IMO, but your conclusion anyway ;-)