Skip to content

Commit

Permalink
Minor changes in README and vignette styles
Browse files Browse the repository at this point in the history
  • Loading branch information
hmeleiro committed May 28, 2024
1 parent 5ea7efd commit 24d9e6f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 10 deletions.
12 changes: 6 additions & 6 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,17 +8,17 @@

[infoelectoral](https://ropenspain.github.io/infoelectoral/) is a R library that helps retrieve official electoral results for Spain from the [Ministry of the Interior](https://infoelectoral.interior.gob.es/opencms/es/inicio/). It allows you to download the results of general, european and municipal elections of any year at the polling station and municipality level.

# Installation
## Installation

``` R
``` r
# To install the latest stable version from CRAN:
install.packages("infoelectoral")

# To install the development version:
devtools::install_github("ropenspain/infoelectoral")
```

# Overview
## Overview

[infoelectoral](https://ropenspain.github.io/infoelectoral/) has four functions:

Expand All @@ -29,14 +29,14 @@ devtools::install_github("ropenspain/infoelectoral")

The package also includes some [datasets](https://ropenspain.github.io/infoelectoral/reference/index.html#datasets) with the official names of the territorial units and the election dates.

# Basic usage
## Basic usage

``` R
``` r
library(infoelectoral)
df <- municipios(tipo_eleccion = "congreso", anno = 1982, mes = "10")
```

# Learn more
## Learn more

For a a extended example of how all functions work please check the vignettes:

Expand Down
8 changes: 4 additions & 4 deletions vignettes/municipios.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ shp_ccaa <- mapSpain::esp_get_ccaa()
```


## Recode the party names
## Recode party names
Since most parties have different names throughout the country, you will need to recode them to group their results. You can use the column `codigo_partido_nacional` included in the resulting `data.frame` that indicates the grouping party code at the national level. After that you'll have to create the complete municipality code (`LAU_CODE`) for the merge with the `sf` object and transform the data from long to wide format.

First, let's group the parties by `codigo_partido_nacional` and `siglas` and sum the votes to see which party codes correspond to the main parties.
Expand Down Expand Up @@ -80,8 +80,8 @@ results <-
```


## Join the voting data to the geometries
With the `LAU_CODE` column merge the data with the geomtries of the municipalities.
## Join data and sf object
With the `LAU_CODE` column merge the data with the geometries of the municipalities.

```{r}
shp <- left_join(shp, results, by = "LAU_CODE")
Expand Down Expand Up @@ -111,7 +111,7 @@ maps <-
) +
geom_sf(
data = shp_ccaa, fill = NA, color = "black",
linewidth = 0.01
linewidth = 0.1
) +
facet_wrap(~siglas_r) +
scale_fill_gradient(
Expand Down

0 comments on commit 24d9e6f

Please sign in to comment.