I would like to make a table for 5 top frequency of countries in a dataset on car production.
I have tried different forms of frequency counts such as:
library(dplyr)
mtcars %>%
group_by(cyl) %>%
summarize(count(cyl))
However, I don't understand how I can display only top 5 production countries. Should I make a frequency list first and then use that to create a table for the top 5 frequency?
Also, the top 5 frequency is NA. I know how to remove those rows in a data frame, but not in the code for the frequency table...
I understand that someone thought this was similar to another question. As explained in my comment before this question was closed, I'm looking for the top count, not the top value. Also, I have tried all the solutions proposed, and it did not work.
Just to reiterate:I'm a complete beginner, and I apologise if what I'm asking is fundamental and that I am asking for a bit of handholding. I would still ask that this question is kept open.
Any help is much appreciated.