[R] count of factors

Laurent Gautier laurent.gautier at lion-ag.de
Thu Sep 2 10:17:46 CEST 1999


I was used to count how many times every factor is found the following
way :

(assuming 'vect' is a vector of factors)

but recently I experienced weird results with this

In fact, my command line was
- 'vect' is a vector of indices
- 'ORGMORE[[1]]' is a slightly long vector of factors

In managed to get correct results using

I am not sure the reason is the presence of NA values in ORGMORE[[1]],
the size of it because I tried unsuccessfully to reproduce this with an
another session
of R and a short vector having NA values.
....and 'vect' is the result of a previous tapply call.

In my opinion, I do not get what I want the good-safe way...

Any hints ?


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