tabulate
Peter Dalgaard BSA
p.dalgaard@biostat.ku.dk
24 Jan 2000 11:22:55 +0100
David Wooff <D.A.Wooff@Durham.ac.uk> writes:
> As far as I know, tabulate appears to have the advantage [for some of my
> tasks] of not excluding bins with zero counts. Otherwise, I would use
> table.
Yes. There are ways around it though, and for multiway tables you'll
need them anyway:
> x<-rpois(20,10)
> x
[1] 10 13 9 9 12 9 15 12 11 7 10 13 10 8 8 12 7 11 5 6
> table(x)
x
5 6 7 8 9 10 11 12 13 15
1 1 2 2 3 3 2 3 2 1
> tabulate(x)
[1] 0 0 0 0 1 1 2 2 3 3 2 3 2 0 1
> table(factor(x,levels=0:max(x)))
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15
0 0 0 0 0 1 1 2 2 3 3 2 3 2 0 1
--
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._