Visualizing_how campaigns have changed over time
Mon Sep 04 2023 18:48:35 GMT+0000 (Coordinated Universal Time)
Saved by
@dr_dziedzorm
# 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)))
content_copyCOPY
Comments