can anyone show me how to get the following done in R? I want to calculate the number of unique people in each group, like the sample showed below, the first column correspond to each group (there're 3 groups here), and second column means people's name (eg, in group 1, people A's name show up 3 times. The third column is the one I want to generate in R (if someone's name shows up x times in a certain group, then the last column should indicates x). Thank you all!
x <- read.table(header=T, text="group peoplename noofuniquepeople
1 A 3
1 B 1
1 A 3
1 A 3
1 D 1
2 M 1
2 K 2
2 T 3
2 T 3
2 K 2
2 T 3
3 E 2
3 F 1
3 E 2
3 G 2
3 G 2
3 V 1")