Message-ID: <97a146780902040719m21b46537h38418f6e4bc89ae1@mail.gmail.com>
Date: 2009-02-04T15:19:31Z
From: axionator
Subject: counting entries in vector
Hi all,
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)
or:
k <- c(5,5,5,5,2,2,4)
=> c(4,2,1)
thanks