# Load the necessary packages library(ggplot2) # Count the frequency of each category category_count <- as.data.frame(table(df$Categories)) colnames(category_count) <- c("Category", "Frequency") # Bar Graph using ggplot2 ggplot(data = category_count, aes(x = reorder(Category, -Frequency), y = Frequency)) + geom_bar(stat = "identity", fill = "blue") + coord_flip() + ggtitle("Frequency of Categories in Responses") + xlab("Categories") + ylab("Frequency") + theme_minimal() # Pie Chart using base R pie(category_count$Frequency, labels = category_count$Category, main = "Frequency of Categories in Responses", col = rainbow(length(category_count$Category)))