U1A3 DISTRIBUCIONES DE FRECUENCIA y COVID-19

Para esto, utilizamos datos de la universidad Johns Hopkins

Importación de paquetes

library(readr) #leer datos
library(plotly) #graficos interactivos
## Loading required package: ggplot2
## 
## Attaching package: 'plotly'
## The following object is masked from 'package:ggplot2':
## 
##     last_plot
## The following object is masked from 'package:stats':
## 
##     filter
## The following object is masked from 'package:graphics':
## 
##     layout
library(tidyverse) #ciencia de datos
## -- Attaching packages --------- tidyverse 1.3.0 --
## v tibble  2.1.3     v dplyr   1.0.0
## v tidyr   1.0.2     v stringr 1.4.0
## v purrr   0.3.3     v forcats 0.4.0
## -- Conflicts ------------ tidyverse_conflicts() --
## x dplyr::filter() masks plotly::filter(), stats::filter()
## x dplyr::lag()    masks stats::lag()
library(gganimate) #animaciones gráficas
library(gifski) #fabricar GIF

Lectura de datos

  • Los datos se leerán desde el repositorio de JHSU
url_conf <- "https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_confirmed_global.csv"

url_decesos <-"https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_deaths_global.csv"

url_recuperados <- "https://raw.githubusercontent.com/CSSEGISandData/COVID-19/master/csse_covid_19_data/csse_covid_19_time_series/time_series_covid19_recovered_global.csv"
  • Leer archivos .csv de las url
datos_conf <- read.csv(url_conf)
datos_decesos <- read.csv(url_decesos)
datos_recuperados<- read.csv(url_recuperados)
  • Extraer datos para México
conf_mex <- t(datos_conf[datos_conf$Country.Region =="Mexico" ,])

dec_mex <- t(datos_decesos[datos_decesos$Country.Region =="Mexico" ,])

rec_mex <- t(datos_recuperados[datos_recuperados$Country.Region =="Mexico" ,])
  • Figura 1 Primer gráfico simple de confirmados de COVID-19 al 2 Septiembre de 2020 para México
plot(conf_mex)
## Warning in xy.coords(x, y, xlabel, ylabel, log): NAs introducidos por coerción