Punto 1
library(data.table)
library(ggrepel)
library(ggthemes)
library(maps)
library(gganimate)
library(GGally)
library(gifski)
library(transformr)
library(tidyverse)
### Cargar datos
cel <- fread("Elections.csv")
cces <- fread("Congreso.csv")
### Punto 1
cel %>%
filter(congress==115) %>%
mutate(Gender= ifelse(female==1, "Female", "Male"), Mayoria= ifelse(majority==1, "Majority", "Minority")) %>%
ggplot(aes(Mayoria, les))+
labs(x = "Majority or Minority ", y = "Legislative Effectiveness",
title = "LES in the 115th Congress")+
geom_boxplot()

Punto 2
### Punto 2
Semestre<- c(1,2,3,4,5,6,
1,2,3,4,5,6,
1,2,3,4,5,6)
Estudiante<- c("Carol","Carol","Carol","Carol","Carol","Carol",
"Davis","Davis","Davis","Davis","Davis","Davis",
"Diana","Diana","Diana","Diana","Diana","Diana")
Grado<- runif(18,min = 80, max = 100)
datos<- data.frame(Semestre,Estudiante,Grado)
ggplot(datos,aes(Semestre,Grado, color=Estudiante))+
labs(x = "Semestre", y = "Grado",
title = "Student Grades by Semester")+
geom_line()+facet_grid(.~ Estudiante)+ theme(legend.position = "none")

Punto 3
cel %>%
mutate(Gender= ifelse(female==1, "Female", "Male")) %>%
ggplot(aes(x=year,fill=Gender))+
labs(title = "Women Participation")+
geom_bar()+
scale_y_continuous(labels = scales::percent, limits = c(0,450)) +
ggthemes::theme_fivethirtyeight()

Punto 4
library(sf)
library(rnaturalearth)
library(rnaturalearthdata)
library(rgeos)
mapa_mundo= map_data("world")
s_america<-ne_countries(scale="medium",continent='South America',returnclass="sf")
unionp <- mapa_mundo %>%
left_join(s_america, by = c("region"="sovereignt"))
unionp %>%
ggplot( aes(x=long, y= lat, group=group, fill = pop_est)) +
geom_polygon(color = "black") +
coord_fixed (xlim= c(-115,-30),
ylim= c(-55,15))+
scale_fill_distiller(palette=10)

Punto 5
Category<-c("Alpha","Beta","Zeta")
City<-c("Hong Kong","London","Nairobi")
my_dat<-expand_grid(Category,City)
set.seed(84684)
my_dat$Value<-sample(1:10,9,replace=T)
anima1<-ggplot(my_dat,aes(x= Category,y=Value,fill=City))+
geom_col()+
transition_states(City)+
enter_fade()+
exit_shrink()+
ease_aes("quadratic-in-out")
anima1
