Subject: Re: tapply not simplifying to vector? (PR#320)
Date: Thu 11 Nov 1999 - 20:54:10 EST
>>>>> "MatW" == Matthew Wiener <firstname.lastname@example.org> writes:
MatW> The help file for tapply says that if simplify is true, and the
MatW> result of the calculation is always a scalar, then tapply will
MatW> return a vector.
>> t1 <- tapply(runif(10), rep(1:5, 2), mean)
R>  FALSE
R>  TRUE
The question really is if the bug is in the code or the documentation.
Here you get a 1D array, something quite rare (but appearing more and more
in recent discussions...).
One could argue that the current behavior of tapply() to always return an
array if simplify = TRUE is more consistent, than what the doc says should
happen (coercing 1D arrays to vectors).
Otoh, the protoype *does* return a vector in this case,
and 1D arrays can be a pain... in other places.
I'm pro fixing this.
and I'll do if I don't hear protests..
MatW> Hope this report helps.
yes indeed, thank you!
R's quality is growing partly because of such fine bug reports!
MatW> Thanks for the terrific software.
Martin Maechler <email@example.com> http://stat.ethz.ch/~maechler/
Seminar fuer Statistik, ETH-Zentrum LEO D10 Leonhardstr. 27
ETH (Federal Inst. Technology) 8092 Zurich SWITZERLAND
phone: x-41-1-632-3408 fax: ...-1228 <><
r-devel mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: firstname.lastname@example.org
This archive was generated by hypermail 2b25 : Tue 04 Jan 2000 - 14:16:10 EST