Hi everyone,

My data looks like this one:
   A    B     C
1 a     1     ff
2 b     1     re
3 c     1     sd
5 a     2     as
6 c     4     fe
7 d     5      tt
8 d     5      tt
9 d     9      oi

I want to add a new column D, which will contain how many an element from
the column A is repeated, like this:
   A    B     C   D
1 a     1     ff    2
2 b     1     re  1
3 c     1     sd  2
5 a     2     as  2
6 c     4     fe   2
7 d     5     tt   3
8 d     5     tt   3
9 d     9     oi   3

I don't want to simplify my data and grouping raws like in this thread:
https://stat.ethz.ch/pipermail/r-help/2011-March/270481.html

Thanks in advance for any help,
best regards,
Bartek

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to