I found a simple solution to getting the most frequent factor of a column in a dataframe using
names(which.max(table(df$column)))
but what if I wanted to find find the most frequent factor inside a chain. Is there a simple code that just gives you the 'mode' of the factors?
Or is there a method to include the above code inside a chain?
I've done it like this, which seems like a huge waste of time.
(df %>% group_by(column) %>% summarise(count=n()) %>% arrange(desc(count)))$count[1]
A simple code would be appreciated, no need to provide sample data. Thanks!