I have:
df<-data.frame(group=c(1, 1, 1, 1, 2, 2, 2),
char=c("a", "b", "z", "a", "c", "c", "b"),
want=c("a", "a", "a", "a", "c", "c", "c"))
df
group char want
1 1 a a
2 1 b a
3 1 z a
4 1 a a
5 2 c c
6 2 c c
7 2 b c
I want to return the value thats the most occuring within the char
variable by group. If there's a way to address ties, (i.e. if there were two a's and two b's in group 1 to say so), that would also be ideal.
Thanks