I have the following dataframe dat
:
> dat
subjectid variable
1 1234 12
2 1234 14
3 2143 19
4 3456 12
5 3456 14
6 3456 13
How do I add another column which shows the count of each unique subjectid
?
ddply(dat,.(subjectid),summarize,quan_95=quantile(variable,0.95),uniq=count(unique(subjectid)))