Covid in Chile

Claudio Torres Casanelli
04-02-2022

Introduction

The following work shows the total covid cases in Chile, using the data provided by the ministry of health. This data is of public use. The presentation includes a description of the code to read the file, a description of the plot generated and a description of the structure of the project.

Data reading

Here we read the data directly from the GitHub site of the ministry of health of Chile. The file contains data from the very beginning of the pandemic so is a very large file because the data is segmented into administrative region and into categories (a lot of them).

covid_chile <- read.csv("https://raw.githubusercontent.com/MinCiencia/Datos-COVID19/master/output/producto3/TotalesPorRegion_std.csv", encoding="UTF-8")
covid_chile <- covid_chile[covid_chile$Categoria == "Casos nuevos totales", ]
covid_chile$Fecha <- as.Date(covid_chile$Fecha)
head(covid_chile)
               Region            Categoria      Fecha Total
18 Arica y Parinacota Casos nuevos totales 2020-03-03     0
19           Tarapacá Casos nuevos totales 2020-03-03     0
20        Antofagasta Casos nuevos totales 2020-03-03     0
21            Atacama Casos nuevos totales 2020-03-03     0
22           Coquimbo Casos nuevos totales 2020-03-03     0
23         Valparaíso Casos nuevos totales 2020-03-03     0

Data Plot

The following plot is showing the total cases in Chile

library(ggplot2)
ggplot(covid_chile[covid_chile$Region == "Total", ], aes(x=Fecha, y=Total)) + geom_line(color="#c169b2", size = 1) + ylab("Daily Covid Confirmed Cases") + xlab("Date")

plot of chunk unnamed-chunk-2

Project Description

I used 3 files.

iu.R -> Here I used a drop down select to identify the administrative regions of my country.

server.R -> Here I used the ggplot library to draw the time series showing the total covid cases in the country by date.

global.R -> Just to perform the data reading and cleansing.