knitr::opts_chunk$set( collapse = TRUE, comment = "#>", fig.path = "man/figures/README-", out.width = "100%" )
The goal of senadoRES is to provide information about the Senate of Spain. It uses the Open Data available and some other XML files I found while exploring the website.
You can install the released version of senadoRES with:
remotes::install_github("llrs/senadoRES")
To make it easier to work and show some data I'll use some packages:
library("senadoRES") library("dplyr") library("ggplot2")
This function return the members of the Senate:
ts <- senadores() head(ts)
We can see the increase of females on the Senate along the legislatures:
ts %>% group_by(legislatura) %>% count(sex) %>% mutate(total = sum(n)) %>% filter(!is.na(sex)) %>% mutate(ratio = n/total) %>% filter(sex != "male") %>% ggplot() + geom_point(aes(legislatura, ratio), size = 5) + geom_hline(yintercept = 0.5, linetype = 2, col = "red") + scale_x_continuous(breaks = seq_len(15)) + scale_y_continuous(labels = scales::percent_format(accuracy = 1), breaks = seq(from = 0, to = 1, by = .1), expand = expansion(add = c(0.01, 0.01)), limits = c(0, NA)) + theme_minimal() + labs(title = "Ratio of women", x = "Legislatura", y = "% of women") + guides(col = "none", shape = "none") + theme(panel.grid.minor.x = element_blank())
Or see what has been done:
b <- boletin(boletin_csv(14, 1)) b[, c("FECHA", "DISP", "apartado", "subapartado", "TITULO", "document")]
So, on the first session of the 14th legislature they dealt with human resources.
We can check one of those documents, to retrieve the text with documento
.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.