Datos Descargado de la organización Mundial de la Salud: https://covid19.who.int/table
data <- read.csv("D:/Maestria/Primer Semestre/Visualizacion/Covid-19/WHO-COVID-19-global-data.csv")
str(data)
## 'data.frame': 121581 obs. of 8 variables:
## $ ĆÆ..ate_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 ...
library(ggplot2)
## Warning: package 'ggplot2' was built under R version 4.0.5
data$ĆÆ..ate_reported <- as.Date(data$ĆÆ..ate_reported)
plotBase <- ggplot(data, aes(ĆÆ..ate_reported, New_deaths))
plotBase <- plotBase + geom_bar(stat="identity")
# accommodate labels
plotBase <- plotBase + labs(title = "COVID-19 Global deaths over time", x= "Date")
plotBase <- plotBase + theme(axis.text.x = element_text(angle = 90, size = 6, hjust = 1))
plotBase <- plotBase + scale_x_date(date_breaks = "1 week")
# plot chart
plotBase
library(ggplot2)
gBarras <- ggplot(data, aes(ĆÆ..ate_reported, New_deaths, fill=WHO_region))
gBarras <- gBarras + geom_bar(stat="identity")
# accommodate labels
gBarras <- gBarras + labs(title = "COVID-19 Global deaths over time", x= "Date")
gBarras <- gBarras + theme(axis.text.x = element_text(angle = 90, size = 6, hjust = 1))
gBarras <- gBarras + scale_x_date(date_breaks = "1 week")
# plot chart
gBarras
gBarras <- gBarras + facet_grid(WHO_region~.)
gBarras
###Casos Colombia
colombia = subset(data, data$Country_code== 'CO')
gline <- ggplot(colombia, aes(ĆÆ..ate_reported, New_deaths))
gline <- gline + geom_line(stat="identity")
# accommodate labels
gline <- gline + labs(title = "COVID-19 Muertes en colombia", x= "Date")
gline <- gline + theme(axis.text.x = element_text(angle = 90, size = 6, hjust = 1))
gline <- gline + scale_x_date(date_breaks = "1 week")
# plot chart
gline
Comparando Colombia y brazil
colombiaBrasil = subset(data, data$Country_code== 'CO' | data$Country_code== 'BR' )
glineColombiaBrasil <- ggplot(colombiaBrasil, aes(ĆÆ..ate_reported, New_deaths,color=Country_code))
glineColombiaBrasil <- glineColombiaBrasil + geom_line(stat="identity")
# accommodate labels
glineColombiaBrasil <- glineColombiaBrasil + labs(title = "COVID-19 Muertes en colombia", x= "Date")
glineColombiaBrasil <- glineColombiaBrasil + theme(axis.text.x = element_text(angle = 90, size = 6, hjust = 1))
glineColombiaBrasil <- glineColombiaBrasil + scale_x_date(date_breaks = "1 week")
# plot chart
glineColombiaBrasil
latAmerica <- subset(data , data$WHO_region=='AMRO' )
gLatAmerica <- ggplot(latAmerica, aes(New_deaths, group=Country_code))
gLatAmerica <- gLatAmerica + geom_boxplot()
gLatAmerica <- gLatAmerica + labs (title= "Casos nuevos de Codiv en LATAM")
gLatAmerica