I have dataframe with id and desicion of yes and no, for example
a <- data.frame(id = c(1,1,1,1,1,2,2,2,3,3,3,3), val = c("y","y","y","n","n","n","n","y","n","n","y","y"))
I want to output for each unique id the most repeated value. i.e example of result for this dataframe would be
data.frame(id = c(1,2,3), val = c("y","n","y"))[result][2]
or
data.frame(id = c(1,2,3), val = c("y","n","n"))
Any help is appreciated thanks in advance!