porcentajeDeVentas <- read.csv("~/ME/TRABAJO_FINAL_DE_CURSO_ME/PorcentajeDeComprasOnline.csv", sep = ",")
attach(porcentajeDeVentas)
colnames(porcentajeDeVentas)<-c("Categorías", "Porcentaje")
a<-ggplot(data=porcentajeDeVentas, aes(x=Categorías, y=Porcentaje, col=Categorías, fill=Categorías)) +
geom_bar(stat="identity")
a

sitios<-read.csv("~/ME/TRABAJO_FINAL_DE_CURSO_ME/sitiosHabitualesDeComprasOnlineEspaña.csv", sep = ",")
colnames(sitios)<-c("Sitios", "2017", "2018", "2019", "2020")
attach(sitios)
2017
#HIST
b<-ggplot(data=sitios, aes(x=Sitios, y= `2017`, col=Sitios, fill=Sitios)) +
ggtitle("SITIOS DESDE DONDE SE REALIZABAN COMPRAS ONLINE EN 2017")+
geom_bar(stat="identity")
b

#PIE CHART
mycols <- c("#0073C2FF","#AF92FF", "#FFD7DA" ,"#01C2FF", "#CD534CFF", "#EFC223FF", "#33C33C")#"#868686FF"
ggplot(sitios, aes(x = "", y = `2017`, fill = Sitios)) +
ggtitle("SITIOS DESDE DONDE SE REALIZABAN COMPRAS ONLINE EN 2017")+
geom_bar(width = 1, stat = "identity", color = "white") +
coord_polar("y", start = 0)+
geom_text(aes(y = `2017`, label = ""), color = "white",position = position_stack(vjust = 0.83))+
scale_fill_manual(values = mycols) +
theme_void()

2018
#HIST
b<-ggplot(data=sitios, aes(x=Sitios, y= `2018`, col=Sitios, fill=Sitios)) +
ggtitle("SITIOS DESDE DONDE SE REALIZABAN COMPRAS ONLINE EN 2018")+
geom_bar(stat="identity")
b

#PIE CHART
ggplot(sitios, aes(x = "", y = `2018`, fill = Sitios)) +
ggtitle("SITIOS DESDE DONDE SE REALIZABAN COMPRAS ONLINE EN 2018")+
geom_bar(width = 1, stat = "identity", color = "white") +
coord_polar("y", start = 0)+
geom_text(aes(y = `2018`, label = ""), color = "white",position = position_stack(vjust = 0.83))+
scale_fill_manual(values = mycols) +
theme_void()

2019
#HIST
b<-ggplot(data=sitios, aes(x=Sitios, y= `2019`, col=Sitios, fill=Sitios)) +
ggtitle("SITIOS DESDE DONDE SE REALIZABAN COMPRAS ONLINE EN 2019")+
geom_bar(stat="identity")
b

#PIECHART
ggplot(sitios, aes(x = "", y = `2019`, fill = Sitios)) +
ggtitle("SITIOS DESDE DONDE SE REALIZABAN COMPRAS ONLINE EN 2019")+
geom_bar(width = 1, stat = "identity", color = "white") +
coord_polar("y", start = 0)+
geom_text(aes(y = `2019`, label = ""), color = "white",position = position_stack(vjust = 0.83))+
scale_fill_manual(values = mycols) +
theme_void()

2020
#HIST
b<-ggplot(data=sitios, aes(x=Sitios, y= `2020`, col=Sitios, fill=Sitios)) +
ggtitle("SITIOS DESDE DONDE SE REALIZABAN COMPRAS ONLINE EN 2020")+
geom_bar(stat="identity")
b

#PIECHART
ggplot(sitios, aes(x = "", y = `2020`, fill = Sitios)) +
ggtitle("SITIOS DESDE DONDE SE REALIZABAN COMPRAS ONLINE EN 2020")+
geom_bar(width = 1, stat = "identity", color = "white") +
coord_polar("y", start = 0)+
geom_text(aes(y = `2020`, label = ""), color = "white",position = position_stack(vjust = 0.83))+
scale_fill_manual(values = mycols) +
theme_void()
