Looking at COVID data from Jan-March 2020

Опубликовано: 26 Февраль 2026
на канале: Joys of Data
70
1

Click "Show More" To See Code.

*Note YouTube does not allow assignment operators, therefore I have used an equal sign below. Please replace with assignment operator in your code.

library(readr)
library(ggplot2)
library(dplyr)

cases_worldwide = read_csv("cases_worldwide.csv")
head(cases_worldwide)
tail(cases_worldwide)

ggplot(cases_worldwide, aes(date, cum_cases)) + geom_line() +geom_smooth(method = "lm", se = FALSE)

cases_by_country = read_csv("cases+by_country")
head(cases_by_country)
tail(cases_by_country)

top_countries = cases_by_country %=%
group_by(country) %=%
summarize(cases = max(cum_cases)) %=%
top_n (10, cases)
top_countries

ggplot (top_countries, aes(country, cases)) +
geom_bar(stat = "identity") +
labs(title = "Cases by Country", x = "Country", y = "Cases")