Worldwide Appearance of Covid-19 Cases

Author

Konci Lawrence

Processing covid-19 test results. DIGICOMPHOTO/SCIENCE PHOTO LIBRARY Rights Managed

Introduction

The “COVID-19 Coronavirus data - daily (up to 14 December 2020)” dataset was collected by the European Centre for Disease Prevention and Control (ECDC). Their goal was to provide maximum transparency of the Covid-19 pandemic globally.

This project analyzes the intuitive and statistical significance of population, location, and the number of cases correlated to Covid-19 deaths.

There are 10 variables, 3 being categorical and 7 being quantitative. In this project I used the following key variables:

  • “Data.Population”

  • “Location.Continent”

  • “Data.Cases”

  • “Data.Death”

  • “Data.Rate”

Loading the Libraries and Dataset

library(ggplot2)
library(dplyr)

Attaching package: 'dplyr'
The following objects are masked from 'package:stats':

    filter, lag
The following objects are masked from 'package:base':

    intersect, setdiff, setequal, union
library(dslabs)

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)

covid <- read.csv("covid.csv") 
#str(covid)

Cleaning the Data

names(covid) <- tolower(names(covid)) #all variables lowercase

names(covid) <- gsub(".","",names(covid), fixed = TRUE) #remove periods
#head(covid)

Exploring the Data

Which continents had the most Covid-19 cases? (Area Chart)

#preparing the data
continent <- covid |>
  group_by(dateyear, locationcontinent) |>
  summarize(datacases = sum(datacases, na.rm = TRUE)) |>
  arrange(dateyear, locationcontinent)
`summarise()` has regrouped the output.
ℹ Summaries were computed grouped by dateyear and locationcontinent.
ℹ Output is grouped by dateyear.
ℹ Use `summarise(.groups = "drop_last")` to silence this message.
ℹ Use `summarise(.by = c(dateyear, locationcontinent))` for per-operation
  grouping (`?dplyr::dplyr_by`) instead.
#defining color palette
cols <- brewer.pal(7, "Set2")

#area chart
highchart () |>
  hc_add_series(data = continent,
                type = "area",
                hcaes(x = dateyear,
                      y = datacases, 
                      group = locationcontinent)) |>
  hc_colors(cols) |> 
  hc_xAxis(title = list(text="Year")) |>
  hc_yAxis(title = list(text="Covid-19 Cases")) |>
  hc_title(text = "Covid-19 Cases by Continent") |>
  hc_caption(text = "Data Source: CORGIS Datasets Projects")

Which continents had the most deaths? (Bar Chart)

#preparing the data
deaths <- covid |>
  group_by(dateyear, locationcontinent) |>
  summarize(datadeaths = sum(datadeaths, na.rm = TRUE)) |>
  arrange(dateyear, locationcontinent)
`summarise()` has regrouped the output.
ℹ Summaries were computed grouped by dateyear and locationcontinent.
ℹ Output is grouped by dateyear.
ℹ Use `summarise(.groups = "drop_last")` to silence this message.
ℹ Use `summarise(.by = c(dateyear, locationcontinent))` for per-operation
  grouping (`?dplyr::dplyr_by`) instead.
#defining color palette
cols <- brewer.pal(7, "Set2")

#area chart
highchart () |>
  hc_add_series(data = deaths,
                type = "bar",
                hcaes(x = dateyear,
                      y = datadeaths, 
                      group = locationcontinent)) |>
  hc_colors(cols) |> 
  hc_xAxis(title = list(text="Year")) |>
  hc_yAxis(title = list(text="Covid-19 Deaths")) |>
  hc_title(text = "Covid-19 Deaths by Continent") |>
  hc_caption(text = "Data Source: CORGIS Datasets Projects")

Regression Analysis

#Testing population, datarate, and datacases for statistical significance

fit <- lm(datadeaths ~ datapopulation + datarate + datacases, data = covid)
summary(fit)

Call:
lm(formula = datadeaths ~ datapopulation + datarate + datacases, 
    data = covid)

Residuals:
    Min      1Q  Median      3Q     Max 
-1918.2    -7.1    -6.6    -6.4  4378.6 

Coefficients:
                 Estimate Std. Error t value Pr(>|t|)    
(Intercept)     6.527e+00  4.090e-01  15.957  < 2e-16 ***
datapopulation  7.537e-09  2.579e-09   2.922  0.00348 ** 
datarate       -1.764e-03  3.358e-03  -0.525  0.59934    
datacases       1.793e-02  8.136e-05 220.410  < 2e-16 ***
---
Signif. codes:  0 '***' 0.001 '**' 0.01 '*' 0.05 '.' 0.1 ' ' 1

Residual standard error: 85.24 on 53625 degrees of freedom
Multiple R-squared:  0.5294,    Adjusted R-squared:  0.5294 
F-statistic: 2.011e+04 on 3 and 53625 DF,  p-value: < 2.2e-16
par(mfrow = c(2, 2))
plot(fit)

Equation: Data deaths = 6.527 + 0.000(datapopulation) + -0.002(datarate) + 0.018(datacases)

P-values: There is a very significance correlation between population and deaths from Covid-19 as shown by the significant code (7.537e-09). Furthermore, the number of cases has a highly significant correlation with Covid-19 deaths (1.793e-02***)

Adjusted R-squared: The adjusted R-squared is 0.5294, meaning that approximately 53% of the variation in Covid-19 deaths is represented by the regression model. The other 47% is caused by factors that may not be represented by this dataset.

Diagnostic Plots: The Residuals vs Fitted plot shows that relating population, data rate, and cases to Covid-19 deaths is appropriate. The Q-Q Residuals plot indicates that the distribution of observations is realtively normal. The Scale-Location plot demonstrates that few observations are are skewing the variance distribution. Additionally, the Residuals vs Leverage plot identifies a few influential observations.

Overall, this model is statistically significant as as the p-value = 2.2e-16.

Conclusion

Cleaning the data

The variables of this dataset had uppercase letters and periods. In order to clean the variable names I used tolower() to convert all names to lowercase. Then I used gsub() to remove the periods in the variable names. This allowed for better reading and handling in exploring the data.

Visualization

The main visualizations explored the covid dataset, identifying the continents with the most Covid-19 cases and resulting deaths. This was achieved using an area chart and bar chart, respectively. Both charts were made to be interactive using the highcharter library.

Technical challenges and Future Studies

While making visualizations, my challenges revolved around the lack of variety in quantitative variables. The majority of the quantitative variables were correlated pertaining to date and time. This would become a restriction in deciding what chart or graph to use. As the covid dataset only has information from 2019 until December 2020, it was a challenge making my graph not appear skewed due to a lack of data. If I were to continue this project, I would like to expand on the unaccounted 47% variation of factors impacting Covid-19 deaths.

References and Data Source

COVID-19 Coronavirus data - daily (up to 14 December 2020). (n.d.). [Data set]. European Centre for Disease Prevention and Control. Retrieved November 10, 2026, from http://data.europa.eu/88u/dataset/covid-19-coronavirus-data-daily-up-to-14-december-2020

Encyclopædia Britannica. (n.d.). Processing covid-19 test results. [Photograph]. Britannica ImageQuest. Retrieved November 10, 2026, from https://quest.eb.com/images/132_9118868

RStudio. (2023, February 25). RPubs - correlation, scatterplots, regression, and interactivity in R. Rpubs.Com. https://rpubs.com/rsaidi/1007730

RStudio. (2025, March 5). RPubs - Exploration of Continuous Variables. Rpubs.Com. https://rpubs.com/rsaidi/cont_var