covid_data <- read.csv("figure-data.csv", stringsAsFactors = FALSE)
colnames(covid_data) <- c("Date", "Social_Media", "Twitter", "Big_Data",
"Google_Trend", "Facebook", "Cell_Phone", "Call_Detail_Records")
head(covid_data)
totals_summary <- covid_data %>%
summarize(
Social_Media = max(Social_Media, na.rm = TRUE),
Twitter = max(Twitter, na.rm = TRUE),
Big_Data = max(Big_Data, na.rm = TRUE),
Google_Trend = max(Google_Trend, na.rm = TRUE),
Facebook = max(Facebook, na.rm = TRUE),
Cell_Phone = max(Cell_Phone, na.rm = TRUE)
)
print(totals_summary)
## Social_Media Twitter Big_Data Google_Trend Facebook Cell_Phone
## 1 530 206 129 78 72 20
Social Media more generally was cited most in pandemic related research articles.
plot_data <- data.frame(
Source = c("Social Media", "Twitter", "Big Data", "Google Trend", "Facebook", "Cell Phone"),
Total_Articles = c(
max(covid_data$Social_Media, na.rm = TRUE),
max(covid_data$Twitter, na.rm = TRUE),
max(covid_data$Big_Data, na.rm = TRUE),
max(covid_data$Google_Trend, na.rm = TRUE),
max(covid_data$Facebook, na.rm = TRUE),
max(covid_data$Cell_Phone, na.rm = TRUE)
)
)
p <- ggplot(data = plot_data, aes(x = reorder(Source, -Total_Articles), y = Total_Articles, fill = Source)) +
geom_col(show.legend = FALSE) +
geom_text(aes(label = Total_Articles), vjust = -0.5, size = 3.5) +
scale_fill_brewer(palette = "Set2") +
labs(
title = "COVID-19 Articles by Source (Feb–Sep 2020)",
x = "Source",
y = "Published Articles"
) +
theme_minimal() +
theme(panel.grid.major.x = element_blank())
print(p)