File:Comparación Partido-Radical Democracia-Cristiana Votos Parlamentarios.png
Original file (3,000 × 1,800 pixels, file size: 160 KB, MIME type: image/png)
Captions
Summary
[edit]DescriptionComparación Partido-Radical Democracia-Cristiana Votos Parlamentarios.png |
English: Comparison between the Deputies vote rate of Radical Party of Chile and Christian Democratic Party |
Date | |
Source | Own work |
Author | TomásDanke |
Código en lenguaje R:
- Paquetes utilizados####
library(tidyverse) library(rvest) library(rlist) library(stringi) library(htmltab) library(qdap) library(Cairo)
- Partido Radical####
- Escrap
url_pr <- 'https://es.wikipedia.org/wiki/Partido_Radical_de_Chile'
elecciones_pr <- url_pr %>% read_html() %>% html_node(xpath = '//*[@id="mw-content-text"]/div/table[3]') %>% html_table(fill = TRUE)
- Arreglo la base
elecciones_pr <- elecciones_pr[,c(1,2,3)] elecciones_pr$Elección <- as.numeric(elecciones_pr$Elección) elecciones_pr$Elección[is.na(elecciones_pr$Elección)] <- 0
elecciones_pr <- elecciones_pr %>% rename(Votos = Diputados,
P.votos = Diputados.1) %>% filter(Elección!=0)
elecciones_pr$P.votos <- gsub(",",".", elecciones_pr$P.votos) elecciones_pr$P.votos <- gsub("%","", elecciones_pr$P.votos) elecciones_pr$P.votos <- gsub("space:", "", elecciones_pr$P.votos) elecciones_pr$P.votos <- as.numeric(elecciones_pr$P.votos)
elecciones_pr$Votos <- as.character(elecciones_pr$Votos) elecciones_pr$Votos <- gsub("\u200b", "", elecciones_pr$Votos) elecciones_pr$Votos <- genX(elecciones_pr$Votos, "[", "]") elecciones_pr$Votos <- gsub("space:", "", elecciones_pr$Votos) elecciones_pr$Votos <- as.numeric(elecciones_pr$Votos)
- Partido Demócrata Cristiano####
- Escrap
url_dc <- 'https://es.wikipedia.org/wiki/Partido_Dem%C3%B3crata_Cristiano_(Chile)'
elecciones_dc <- url_dc %>%
read_html() %>% html_node(xpath = '//*[@id="mw-content-text"]/div/table[7]') %>% html_table(fill = TRUE)
- Arreglo la base
elecciones_dc <- elecciones_dc[,c(1,2,3)] elecciones_dc$Elección <- as.numeric(elecciones_dc$Elección) elecciones_dc$Elección[is.na(elecciones_dc$Elección)] <- 0 elecciones_dc <- elecciones_dc %>% rename(Votos = Diputados,
P.votos = Diputados.1) %>% filter(Elección!=0)
elecciones_dc$P.votos <- gsub(",",".", elecciones_dc$P.votos) elecciones_dc$P.votos <- gsub("%","", elecciones_dc$P.votos) elecciones_dc$P.votos <- gsub("space:", "", elecciones_dc$P.votos) elecciones_dc$P.votos <- as.numeric(elecciones_dc$P.votos)
elecciones_dc$Votos <- as.character(elecciones_dc$Votos) elecciones_dc$Votos <- gsub("\u200b", "", elecciones_dc$Votos) elecciones_dc$Votos <- genX(elecciones_dc$Votos, "[", "]") elecciones_dc$Votos <- gsub("space:", "", elecciones_dc$Votos) elecciones_dc$Votos <- as.numeric(elecciones_dc$Votos)
- Ambos####
elecciones_pr$Partido <- rep("Partido Radical", nrow(elecciones_pr))
elecciones_dc$Partido <- rep("Partido Demócrata Cristiano",
nrow(elecciones_dc))
elecciones_2partidos <- rbind(elecciones_pr,
elecciones_dc)
- Gráfico
CairoWin()
plot_final <- elecciones_2partidos %>%
ggplot( aes(x=Elección, y=P.votos, colour=Partido)) + geom_line() + geom_point() + labs(x = "Año de la elección", y = "Porcentaje de votos parlamentarios", caption = "Fuente: Wikipedia") + scale_x_continuous(breaks = c(seq(1891, 1924, by=3), 1925, 1932, seq(1937, 1973, by=4), seq(1989, 2017, by=4))) + scale_y_continuous(breaks = c(seq(0,50,by=5)))+ scale_color_manual(values=c("blue1","red1")) + theme_light() + theme(text = element_text(size=7, family = "TT Arial"), axis.text.x = element_text(angle=90, hjust=1))
Licensing
[edit]- You are free:
- to share – to copy, distribute and transmit the work
- to remix – to adapt the work
- Under the following conditions:
- attribution – You must give appropriate credit, provide a link to the license, and indicate if changes were made. You may do so in any reasonable manner, but not in any way that suggests the licensor endorses you or your use.
- share alike – If you remix, transform, or build upon the material, you must distribute your contributions under the same or compatible license as the original.
File history
Click on a date/time to view the file as it appeared at that time.
Date/Time | Thumbnail | Dimensions | User | Comment | |
---|---|---|---|---|---|
current | 21:48, 4 July 2020 | 3,000 × 1,800 (160 KB) | TomásDanke (talk | contribs) | Uploaded own work with UploadWizard |
You cannot overwrite this file.
File usage on Commons
There are no pages that use this file.
Metadata
This file contains additional information such as Exif metadata which may have been added by the digital camera, scanner, or software program used to create or digitize it. If the file has been modified from its original state, some details such as the timestamp may not fully reflect those of the original file. The timestamp is only as accurate as the clock in the camera, and it may be completely wrong.
Horizontal resolution | 118.11 dpc |
---|---|
Vertical resolution | 118.11 dpc |