From p.dalgaard@biostat.ku.dk  Mon Jan 24 10:22:55 2000
From: p.dalgaard@biostat.ku.dk (Peter Dalgaard BSA)
Date: 24 Jan 2000 11:22:55 +0100
Subject: tabulate
In-Reply-To: David Wooff's message of "Mon, 24 Jan 2000 09:59:20 +0000"
References: <200001230026.LAA16510@snowy.nsw.cmis.CSIRO.AU> <388C2278.EF4119E1@Durham.ac.uk>
Message-ID: <x2u2k3kbuo.fsf@blueberry.kubism.ku.dk>

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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._


tabulate
Peter Dalgaard BSA