https://github.com/ropenspain/senadores
Information about the senators of Spain.
https://github.com/ropenspain/senadores
goverment-data rstats-package spain transparency
Last synced: about 2 months ago
JSON representation
Information about the senators of Spain.
- Host: GitHub
- URL: https://github.com/ropenspain/senadores
- Owner: rOpenSpain
- License: other
- Created: 2020-11-06T09:25:16.000Z (almost 5 years ago)
- Default Branch: master
- Last Pushed: 2024-12-24T10:09:31.000Z (10 months ago)
- Last Synced: 2025-04-08T03:35:38.834Z (7 months ago)
- Topics: goverment-data, rstats-package, spain, transparency
- Language: R
- Homepage: https://ropenspain.github.io/senadoRES/
- Size: 1.68 MB
- Stars: 1
- Watchers: 1
- Forks: 1
- Open Issues: 8
-
Metadata Files:
- Readme: README.Rmd
- Changelog: NEWS.md
- License: LICENSE
Awesome Lists containing this project
README
---
output: github_document
editor_options:
chunk_output_type: console
---
```{r, include = FALSE}
knitr::opts_chunk$set(
collapse = TRUE,
comment = "#>",
fig.path = "man/figures/README-",
out.width = "100%"
)
```
# senadoRES
[](https://www.tidyverse.org/lifecycle/#experimental)
[](https://codecov.io/gh/rOpenSpain/senadoRES?branch=master)
[](https://github.com/rOpenSpain/senadoRES/actions/workflows/R-CMD-check.yaml)
The goal of senadoRES is to provide information about the [Senate of Spain](https://en.wikipedia.org/wiki/Senate_of_Spain).
It uses the [Open Data](https://www.senado.es/web/relacionesciudadanos/datosabiertos/catalogodatos/index.html) available and some other XML files I found while exploring the website.
## Installation
You can install the released version of senadoRES with:
``` r
remotes::install_github("llrs/senadoRES")
```
## Example
To make it easier to work and show some data I'll use some packages:
```{r example}
library("senadoRES")
library("dplyr")
library("ggplot2")
```
### Senadores
This function return the members of the Senate:
```{r senadores}
ts <- senadores()
head(ts)
```
We can see the increase of females on the Senate along the legislatures:
```{r senadoras}
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:
```{r boletin}
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`.