library(tidyverse)
library(tidylog)
library(plotly)
d <- read.csv("processesd.csv")
g_countries <- c("Saudi Arabia", "United Arab Emirates", "Bahrain", "Qatar", "Kuwait", "Oman")
g_gulf <-
d %>%
filter(country_region %in% g_countries,
date == '2020-04-03')
Saudi Arabia has the highest number of death cases but the number is reasonable given the number of people living in the kingdom.
g_gulf %>%
ggplot(aes(x = reorder(country_region, -deaths_num), y = deaths_num)) +
geom_col() +
labs(
x = "",
y = "number of death cases",
title = "Saudi Arabia has the highest death cases among gulf countries"
)
highest_confirmed_countries <-
d %>%
filter(date == '2020-04-03') %>%
pivot_longer(-c(date, country_region), names_to = "case_type") %>%
filter(case_type == "confirmed_num") %>%
arrange(desc(value)) %>%
head(10) %>%
pull(country_region)
highest_deaths_countries <-
d %>%
filter(date == '2020-04-03') %>%
pivot_longer(-c(date, country_region), names_to = "case_type") %>%
filter(case_type == "deaths_num") %>%
arrange(desc(value)) %>%
head(10) %>%
pull(country_region)
highest_recovered_countries <-
d %>%
filter(date == '2020-04-03') %>%
pivot_longer(-c(date, country_region), names_to = "case_type") %>%
filter(case_type == "recovered_num") %>%
arrange(desc(value)) %>%
head(10) %>%
pull(country_region)
d_top_countries <-
c(highest_recovered_countries, highest_deaths_countries, highest_confirmed_countries) %>%
unique()
d %>%
filter(date == '2020-04-03',country_region %in% d_top_countries) %>%
pivot_longer(-c(date, country_region), names_to = "case_type") %>%
ggplot(aes(x = reorder(country_region, value), y = value, fill= case_type))+
geom_col(position = "dodge")+
coord_flip()+
labs(
x = "",
y = "",
title = "China has the highest recovery numbers")