[R] counting entries in vector

Ben Bolker bolker at ufl.edu
Wed Feb 4 16:33:17 CET 2009

axionator <axionator <at> gmail.com> writes:

> I've a vector with entries, which are all of the same type, e.g. string:
> k <- c("bb", "bb", "bb", "aa", "cc", "cc")
> and want to create a second vector containing the number of each entry
> in k in the same order as in k, i.e.
> c(3, 1, 2)


  Ben Bolker

More information about the R-help mailing list