How to find mode across variables/vectors within a data row in R
问题 This question was migrated from Cross Validated because it can be answered on Stack Overflow. Migrated 6 years ago . Does anyone know how to find the mode (most frequent across variables for a single case in R? For example, if I had data on favorite type of fruit (x), asked nine times (x1-x9) for each respondent (id) in a survey. If I wanted to find the modal response for each test subject in the first five times asked, how would I program that in R? More succinctly, with the example data is