[R] count of factors
Thomas Lumley
thomas at biostat.washington.edu
Thu Sep 2 17:51:27 CEST 1999
On Thu, 2 Sep 1999, Laurent Gautier wrote:
> Hello,
>
>
> I was used to count how many times every factor is found the following
> way :
>
> (assuming 'vect' is a vector of factors)
> tapply(vect,vect,length)
You could use table(vect) to count the number of times each level appears
in vect.
Thomas Lumley
Assistant Professor, Biostatistics
University of Washington, Seattle
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help 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-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list