tapply not simplifying to vector? (PR#320)
Peter Dalgaard BSA
p.dalgaard@biostat.ku.dk
11 Nov 1999 12:46:35 +0100
maechler@stat.math.ethz.ch writes:
> I'm pro fixing this.
> and I'll do if I don't hear protests..
Protest!...
> tapply(Ozone,list(Month=Month),mean,na.rm=T)
Month
May June July August September
23.61538 29.44444 59.11538 59.96154 31.44828
Notice the "Month" in the output.
> dput(tapply(Ozone,list(Month=Month),mean,na.rm=T))
structure(c(23.6153846153846, 29.4444444444444, 59.1153846153846,
59.9615384615385, 31.4482758620690), .Dim = 5, .Dimnames = structure(list(
Month = c("May", "June", "July", "August", "September")), .Names = "Month"))
Notice that the Month is the tag name of the single component of the
dimnames vector, it will disappear if you try coercing it to a vector.
--
O__ ---- Peter Dalgaard Blegdamsvej 3
c/ /'_ --- Dept. of Biostatistics 2200 Cph. N
(*) \(*) -- University of Copenhagen Denmark Ph: (+45) 35327918
~~~~~~~~~~ - (p.dalgaard@biostat.ku.dk) FAX: (+45) 35327907
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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: r-devel-request@stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._