Skip to contents

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()

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).

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.

Note

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

See also

Examples

if (FALSE) { # \dontrun{
senators <- get_argentine_senators()
head(senators)

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