Find number of occurrences of modal value for a group using data.table [R]
问题 I've been using the excellent answer here to find the mode for groups with data table. However, I'd also like to find the number of occurrences of the modal value of x for each group of variable y. How can I do this? Edit: there is a faster way to find mode than in the answer linked above. I can't find the answer I got it from (please edit and link if you do), but it uses this function (and finds multiple modes if they exist): MultipleMode <- function(x) { ux <- unique(x) tab <- tabulate