Visualización descriptiva Covid-19 29/05/2021

Datos descargados de la WHO https://covid19.who.int/

covid_19_29_5 <- read.csv("~/Inteligencia de negocios/Covid_19/covid_19_29-5.csv")
str(covid_19_29_5)
## 'data.frame':    121581 obs. of  8 variables:
##  $ ï..Date_reported : chr  "2020-01-03" "2020-01-04" "2020-01-05" "2020-01-06" ...
##  $ Country_code     : chr  "AF" "AF" "AF" "AF" ...
##  $ Country          : chr  "Afghanistan" "Afghanistan" "Afghanistan" "Afghanistan" ...
##  $ WHO_region       : chr  "EMRO" "EMRO" "EMRO" "EMRO" ...
##  $ New_cases        : int  0 0 0 0 0 0 0 0 0 0 ...
##  $ Cumulative_cases : int  0 0 0 0 0 0 0 0 0 0 ...
##  $ New_deaths       : int  0 0 0 0 0 0 0 0 0 0 ...
##  $ Cumulative_deaths: int  0 0 0 0 0 0 0 0 0 0 ...
covid_19_29_5$ï..Date_reported <- as.Date(covid_19_29_5$ï..Date_reported)

Gráfico global

library(ggplot2)
graf_barras <- ggplot(covid_19_29_5,aes(ï..Date_reported,New_cases))
graf_barras <- graf_barras + geom_bar(stat='identity')
graf_barras <- graf_barras + labs(title="Casos Nuevos a Nivel Mundial", x="Dia", y="Casos nuevos")
graf_barras <- graf_barras + theme(axis.text.x= element_text(angle=90, size=6, hjust=1))
graf_barras <- graf_barras + scale_x_date(date_breaks="1 week")
graf_barras

Gráfico por Regiones

library(ggplot2)
graf_barras <- ggplot(covid_19_29_5,aes(ï..Date_reported,New_cases, fill=WHO_region))
graf_barras <- graf_barras + geom_bar(stat='identity')
graf_barras <- graf_barras + labs(title="Casos nuevos a nivel mundial", x="Dia", y="Casos nuevos")
graf_barras <- graf_barras + theme(axis.text.x= element_text(angle=90, size=6, hjust=1))
graf_barras <- graf_barras + facet_grid(.~WHO_region)
graf_barras <- graf_barras + scale_x_date(date_breaks="1 week")
graf_barras

graf_barras <- graf_barras + facet_grid(WHO_region~.)
graf_barras <- graf_barras + scale_x_date(date_breaks="1 week")
## Scale for 'x' is already present. Adding another scale for 'x', which will
## replace the existing scale.
graf_barras

## El caso de Colombia

colombia <- subset(covid_19_29_5, covid_19_29_5$Country_code=='CO')
graf_barras <- ggplot(colombia, aes(ï..Date_reported,New_cases, group=Country_code))
graf_barras <- graf_barras + geom_line(color='blue')
graf_barras <- graf_barras + labs(title="Casos Nuevos en Colombia", x="Dia", y="Casos nuevos")
graf_barras <- graf_barras + theme(axis.text.x= element_text(angle=90, size=6, hjust=1))
graf_barras <- graf_barras + scale_x_date(date_breaks="1 week")
graf_barras

## Algunos Paises de LA

Colombia y Brasil

colombia_brasil <- subset(covid_19_29_5, covid_19_29_5$Country_code=='CO'| covid_19_29_5$Country_code=='BR')
graf_barras <- ggplot(colombia_brasil, aes(ï..Date_reported,New_cases, group=Country_code, color=Country_code))
graf_barras <- graf_barras + geom_line()
graf_barras <- graf_barras + labs(title="Casos Nuevos en Colombia y Brasil", x="Dia", y="Casos nuevos")
graf_barras <- graf_barras + theme(axis.text.x= element_text(angle=90, size=6, hjust=1))
graf_barras <- graf_barras + scale_x_date(date_breaks="1 week")
graf_barras

Colombia

latinoamerica <- subset(covid_19_29_5, covid_19_29_5$WHO_region=='AMRO')
graf_barras <- ggplot(latinoamerica, aes(New_cases, group=Country_code))
#graf_barras <- graf_barras + geom_line(color='blue')
#graf_barras <- graf_barras + geom_density (stat='identity')
graf_barras <- graf_barras + geom_boxplot ()
graf_barras <- graf_barras + labs(title="Casos Nuevos en LATAM")
graf_barras