Coronavirus, formally known as Covid-19 was a global pandemic that had lasted from 2019-2023. It started in China on December 2019 and soon spread to other countries by 2020, including the US and UK, claiming millions of lives.
The European Centre for Disease Prevention and Control collected data from all around the world, tracking the number of new Covid-19 cases, deaths, and rate, every day, from 2019 to 2020. This data set has three categorical variables: country code, country name, and continent, and seven numerical variables: day, month, year, new cases, deaths, population, and rate (which is the cumulative number of cases reported every 14 days per 100,000 people). From this data set, I plan to use the country and continent for my categorical variables and the day, month, year, new cases, deaths, and population as my numerical variables. These variables will be used to explore the following questions:
1) How much of an increase is there in cases based on the population of a country?
2) Does the season affect the number of new cases there are?
3) How much of a difference is there in the number of cases and deaths in the US vs in the UK?
Methodology
The data set goes under the Metadata Quality Assessment (MQA) which measures the findability, accessibility, interoperability, reusability, and contextuality of the data set out of 405 points. Based on the rating of the data set under those categories, there is four rating groups that the data set can go under for the MQA: Excellent (351-405), Good (221-350), Sufficient (121-220), and Bad (0-120). The Covid-19 data set had the MQA rating of “Good”.
Why?
I chose this data set not only because it is a topic that I am familiar with and would be able to understand, but also because it would be interesting to see if there were any patterns or trends that can be found from data in 2019-2020 that could have been used for the next few years where cases would still be ongoing.
Load Libraries and Clean Data
#Loading Librarieslibrary(tidyverse)
Warning: package 'tidyverse' was built under R version 4.6.1
Warning: package 'readr' was built under R version 4.6.1
Warning: package 'dplyr' was built under R version 4.6.1
── Attaching core tidyverse packages ──────────────────────── tidyverse 2.0.0 ──
✔ dplyr 1.2.1 ✔ readr 2.2.0
✔ forcats 1.0.1 ✔ stringr 1.6.0
✔ ggplot2 4.0.3 ✔ tibble 3.3.1
✔ lubridate 1.9.5 ✔ tidyr 1.3.2
✔ purrr 1.2.2
── Conflicts ────────────────────────────────────────── tidyverse_conflicts() ──
✖ dplyr::filter() masks stats::filter()
✖ dplyr::lag() masks stats::lag()
ℹ Use the conflicted package (<http://conflicted.r-lib.org/>) to force all conflicts to become errors
library(dplyr)library(dslabs)#Uploading Covid CSV file to Rsetwd("C:/Users/24680/Downloads")data<-read_csv("covid.csv")
Rows: 53629 Columns: 10
── Column specification ────────────────────────────────────────────────────────
Delimiter: ","
chr (3): Location.Country, Location.Code, Location.Continent
dbl (7): Date.Day, Date.Month, Date.Year, Data.Cases, Data.Deaths, Data.Popu...
ℹ Use `spec()` to retrieve the full column specification for this data.
ℹ Specify the column types or set `show_col_types = FALSE` to quiet this message.
#Linear regression# How much of an increase is there in cases based on the population of a country?model<-lm(Data.Cases~Data.Population, data=countries)summary(model)
Call:
lm(formula = Data.Cases ~ Data.Population, data = countries)
Residuals:
Min 1Q Median 3Q Max
-17529 -537 -411 -363 98175
Coefficients:
Estimate Std. Error t value Pr(>|t|)
(Intercept) 4.009e+02 2.087e+01 19.21 <2e-16 ***
Data.Population 1.195e-05 1.302e-07 91.76 <2e-16 ***
---
Signif. codes: 0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1
Residual standard error: 4667 on 53627 degrees of freedom
Multiple R-squared: 0.1357, Adjusted R-squared: 0.1357
F-statistic: 8420 on 1 and 53627 DF, p-value: < 2.2e-16
options(scipen=999)countries%>%ggplot(aes(x=Data.Population, y=Data.Cases, color=Data.Population))+geom_point(size=3, alpha=0.3)+geom_smooth(method=lm)+labs(title ="Line of Regression Model",x ="Population of Countries",y="Number of Cases")
`geom_smooth()` using formula = 'y ~ x'
Warning: The following aesthetics were dropped during statistical transformation:
colour.
ℹ This can happen when ggplot fails to infer the correct grouping structure in
the data.
ℹ Did you forget to specify a `group` aesthetic or to convert a numerical
variable into a factor?
For this linear regression model, I wanted to see if the increase in the number of cases was influenced by the population in a country. So, the formula model I made has the Data.Cases (number of cases) as what is being measured and the Data.Population (population of a country) as the variable.
With p being the population of the country, the equation of my model would be:
Cases = 400.87 + 0.00001p
In order for the data to be significant, the p-value would have to be less than 2.2 x 10-16 (which is 0.00000000000000022). You can see that even though the population of the country may be significant at a p-value of 0.001 (meaning it isn’t by chance and that the population can have an effect on the number of cases), the correlation of it (using the adjusted R2 ) is quite low with the adjusted R2 being 0.1357.
Visual 1:
#First Visualization#Does the season affect the number of new cases there are?library(highcharter)
Registered S3 method overwritten by 'quantmod':
method from
as.zoo.data.frame zoo
Attaching package: 'highcharter'
The following object is masked from 'package:dslabs':
stars
library(RColorBrewer)arranged<-countries%>%arrange(Date.Year)filtered<-arranged%>%filter(Date.Year!=2019)cols<-brewer.pal(4, "Set3")highchart()|>hc_add_series(data=filtered,type="point", hcaes(x=Date.Month, y=Data.Cases,group=Location.Continent))|>#Adding Color to Graphhc_colors(cols)|>#Titles and Text on Graphhc_title(text ="New Covid-19 Cases in Each Continent in 2020")|>#Adding Source as a captionhc_caption(text ="Source: European Centre of Disease Control")|>#Adding Axis Titleshc_xAxis(title =list(text ="Month"))|>hc_yAxis(title =list(text ="Number of New Cases"))
This first visualization is shown by a high chart where the x-axis would be the months in 2020 and the y-axis would be the number of cases in each continent. The points represent the number of new cases in each continent in each month (since a month is about 30 days, there will be multiple points of the same color being plotted under each month). Based on the graph, you can see that it is mainly ascending. It does start spiking up during the summer months (June, July, and August) but that also goes for the winter and fall months as it gets colder. In Asia, there was more of a spike on cases around the time we would consider the fall time. Even though this is just the first year of Covid-19, the increase in cases during the summer and winter was later found out a couple years after using data from 2022 (Shamsa, El Hussain, et al). If this graph were to be used during the first year of Covid-19, patterns like this that were found during that time could be mentioned earlier and it could be a way to spread awareness and caution during those seasons.
The second visualization is a stacked chart on Tableau of both the new Covid-19 cases and deaths in 2020. The x-axis would be the months of the year and the y-axis would be the number of cases (at the graph on the top) and the number of deaths (at the graph on the bottom). You can see that the number of new Covid-19 cases and deaths was significantly greater in the US than in the UK. Population can play as a factor to the visibly greater number of cases and deaths in the US than in the UK.
Conclusion
The visualizations shown above represent the number of cases in both each continent (first visualization) and in the US and UK (in the second visualization which also shows the number of deaths). The first visualization showed a pattern of a spike in cases during the summer and winter that was later found. Although this was the first year of Covid-19, that was something that could be considered when looking at the first visualization and seeing if the pattern continued in the next couple years. The second visualization showed the significant difference between the US and UK in terms of the number of cases and deaths. I would probably like to see and compare the Covid-19 cases in the US and Asia because the gap in the difference in population wouldn’t be as significant compared to other countries or continents. I would also like to see how the rate increases based on the population of a country.
“Coronavirus Disease (Covid-19) Pandemic.” World Health Organization, www.who.int/europe/emergencies/situations/covid-19. Accessed 2 July 2026.
“Metadata Quality Assessment Methodology - European Data.” European Union, data.europa.eu/mqa/methodology. Accessed 2 July 2026.
Shamsa, El Hussain, et al. “Seasonality of COVID-19 Incidence in the United States - PMC.” National Library of Medicine, 5 Nov. 2023, pmc.ncbi.nlm.nih.gov/articles/PMC10728821/.