#REPORTE COVID WHO PARA HOY ##Mayo 11 2023

#Importar dataser
data <- read.csv("D:/Usuario/Desktop/Visualización de datos/WHO-COVID-19-global-data.csv", stringsAsFactors=TRUE)

str(data)
## 'data.frame':    290088 obs. of  8 variables:
##  $ Date_reported    : Factor w/ 1224 levels "2020-01-03","2020-01-04",..: 1 2 3 4 5 6 7 8 9 10 ...
##  $ Country_code     : Factor w/ 236 levels " ","AD","AE",..: 4 4 4 4 4 4 4 4 4 4 ...
##  $ Country          : Factor w/ 237 levels "Afghanistan",..: 1 1 1 1 1 1 1 1 1 1 ...
##  $ WHO_region       : Factor w/ 7 levels "AFRO","AMRO",..: 3 3 3 3 3 3 3 3 3 3 ...
##  $ 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 ...
data$Date_reported <- as.Date(data$Date_reported)

###Casos confirmados por semana

library(ggplot2)
## Warning: package 'ggplot2' was built under R version 4.2.3
grafica <- ggplot(data, aes(Date_reported,New_cases))
grafica <- grafica + geom_bar(stat = 'identity')
#grafica <- grafica + geom_col()
grafica <- grafica + scale_x_date(date_breaks= "4 week", date_labels="%y %b %d")
grafica <- grafica + theme(axis.text.x = element_text(angle=90, size=7))
grafica <- grafica + labs(y="Nuevos casos", x="Fecha", title= "Nuevos casos Covid 19 global", subtitle="Casos por mes")
grafica

library(ggplot2)

grafica <- ggplot(data, aes(Date_reported,Cumulative_cases))
grafica <- grafica + geom_bar(stat = 'identity')
#grafica <- grafica + geom_col()
grafica <- grafica + scale_x_date(date_breaks= "4 week", date_labels="%y %b %d")
grafica <- grafica + theme(axis.text.x = element_text(angle=90, size=7))
grafica <- grafica + labs(y="Nuevos casos", x="Fecha", title= "Nuevos casos Covid 19 global", subtitle="Casos por mes")
grafica

library(ggplot2)

grafica <- ggplot(data, aes(Date_reported,New_cases, fill=WHO_region))
grafica <- grafica + geom_bar(stat = 'identity')
#grafica <- grafica + geom_col()
grafica <- grafica + scale_x_date(date_breaks= "4 week", date_labels="%y %b %d")
grafica <- grafica + theme(axis.text.x = element_text(angle=90, size=7))
grafica <- grafica + labs(y="Nuevos casos", x="Fecha", title= "Nuevos casos Covid 19 global", subtitle="Casos por mes")
grafica

library(ggplot2)

europa <- subset(data, data$WHO_region=='EURO')
grafica <- ggplot(europa, aes(Date_reported,New_cases, fill=WHO_region))
grafica <- grafica + geom_bar(stat = 'identity')
#grafica <- grafica + geom_col()
grafica <- grafica + scale_x_date(date_breaks= "4 week", date_labels="%y %b %d")
grafica <- grafica + theme(axis.text.x = element_text(angle=90, size=7))
grafica <- grafica + labs(y="Nuevos casos", x="Fecha", title= "Nuevos casos Covid 19 global", subtitle="Casos por mes")
grafica