I have a data set for example,
Data <- data.frame(
groupname = as.factor(sample(c("a", "b", "c"), 10, replace = TRUE)),
someuser = sample(c("x", "y", "z"), 10, replace = TRUE))
groupname someuser
1 a x
2 b y
3 a x
4 a y
5 c z
6 b x
7 b x
8 c x
9 c y
10 c x
How do I aggregate the data so that I get:
groupname someuser
a x
b x
c x
that is the most common value for each of the groupname.
PS: Given my setup, I have the limitation of using only 2 pakcages - plyr & lubridate