I have the following data table:
n col1
1 c('1', '1', '2')
2 1
3 c('3', '3', '1')
4 3
And as an output, I want to only have only the most frequent character appearing in each of the rows.So, it would be something like this:
n col2
1 1
2 1
3 3
4 3
I don't really know how to approach this problem in R. It should be something like finding the most frequent value in the list. I googled that there is table() function, but I can't figure out how I should use it here. It doesn't look like something really hard, but I just can't figure it out