I have a dataset similar to this and have created a bar graph with ggplot to show how many times a person says a certain word.
name <- c('Luca', 'Marco','Alberto', 'Luca', 'Marco', 'Luca', 'Alberto', 'Marco')
word <- c('pizza', 'cola', 'pizza','cola','pizza', 'good', 'good', 'chips')
count <- c(3,5,6,4,1,3,6,2)
ggplot(df, aes(y=word, x=count, fill=name)) +
geom_col()
This is the result. However, I want to display only a part of the image, ie the first two most frequent words.This is the result. However I want to display only a part of the image (the first two most frequent words). This is a simplification of my real database, because in that one I have about 30k thousand words and I would like to take only the first 20. Thank you all