get_argentine_senators {ArgentinAPI}R 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:

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)


[Package ArgentinAPI version 0.1.0 Index]