get_argentine_senators: Get Current and Past Senators of Argentina

View source: R/get_argentine_senators.R

get_argentine_senatorsR Documentation

Get Current and Past Senators of Argentina

Description

This function retrieves a list of senators from the Argentine Senate API endpoint: 'https://api.argentinadatos.com/v1/senado/senadores'. The result includes name, province, party affiliation, and their legal term of office. The results are sorted by the start of their legal term in descending order (most recent first).

Usage

get_argentine_senators()

Details

The function parses the nested JSON structure returned by the API, extracts the period data, and ensures that 'inicio' and 'fin' are treated as proper 'Date' objects. The data is sorted by 'inicio' in descending order to prioritize currently active or recently active senators.

Value

A data frame (tibble) with the following columns:

  • id: Unique identifier of the senator.

  • nombre: Full name of the senator.

  • provincia: Province represented.

  • partido: Political party.

  • inicio: Start date of the legal period (Date).

  • fin: End date of the legal period (Date).

Note

Requires internet access. Be cautious with malformed or missing date fields.

See Also

GET, fromJSON, arrange

Examples

## Not run: 
senators <- get_argentine_senators()
head(senators)

# Filter only currently active senators
active <- dplyr::filter(senators, Sys.Date() <= fin)

## End(Not run)


ArgentinAPI documentation built on Aug. 8, 2025, 6:27 p.m.