ArgentinAPI: Access Argentine Economic, Social, and Geopolitical Data via RESTful APIs and Curated Datasets

library(ArgentinAPI)
library(dplyr)
#> 
#> Adjuntando el paquete: 'dplyr'
#> The following objects are masked from 'package:stats':
#> 
#>     filter, lag
#> The following objects are masked from 'package:base':
#> 
#>     intersect, setdiff, setequal, union
library(ggplot2)

Introduction

The ArgentinAPI package provides a unified interface to access open data from the ArgentinaDatos API and the REST Countries API, with a focus on Argentina. It allows users to easily retrieve up-to-date information on exchange rates, inflation, political figures, national holidays, and country-level indicators relevant to Argentina.

In addition to API-access functions, the package includes a collection of curated datasets related to Argentina, covering diverse domains such as economic indicators, biodiversity, agriculture, human rights, genetics, and consumer prices.

ArgentinAPI is designed to support research, teaching, and data analysis focused on Argentina by integrating publicly available APIs and high-quality datasets into a single, easy-to-use R package.

Functions for ArgentinAPI

The ArgentinAPI package provides several core functions to access real-time and structured information about Argentina from public APIs such as ArgentinaDatos and REST Countries. Below is a list of the main functions included in the package:

These functions allow users to access high-quality and structured information on Argentina, which can be combined with tools like dplyr, tidyr, and ggplot2 to support a wide range of data analysis and visualization tasks. In the following sections, you’ll find examples on how to work with ArgentinAPI in practical scenarios.

List of Argentine Senators


# Display the first 10 Argentine senators

argentine_senators <- head(get_argentine_senators(),n=10)

print(argentine_senators)
#> # A tibble: 10 × 6
#>    id    nombre                        provincia  partido  inicio     fin       
#>    <chr> <chr>                         <chr>      <chr>    <date>     <date>    
#>  1 577   Cora, Stefania                Entre Ríos Frente … 2025-02-20 2025-12-09
#>  2 294   Mayans, José Miguel Ángel     Formosa    Alianza… 2023-12-10 2029-12-09
#>  3 551   Paoltroni, Francisco Manuel   Formosa    Alianza… 2023-12-10 2029-12-09
#>  4 555   López, María Florencia        La Rioja   Alianza… 2023-12-10 2029-12-09
#>  5 557   Pagotto, Juan Carlos          La Rioja   Alianza… 2023-12-10 2029-12-09
#>  6 558   Arce, Carlos Omar             Misiones   Frente … 2023-12-10 2029-12-09
#>  7 559   Rojas Decut, Sonia Elizabeth  Misiones   Frente … 2023-12-10 2029-12-09
#>  8 560   Goerling Lara, Enrique Martin Misiones   Juntos … 2023-12-10 2029-12-09
#>  9 561   Uñac, Sergio Mauricio         San Juan   Alianza… 2023-12-10 2029-12-09
#> 10 563   Olivera Lucero, Bruno Antonio San Juan   Alianza… 2023-12-10 2029-12-09

Corn Yield Response to Nitrogen Levels


# Summary: average corn yield by nitrogen level
corn_summary <- corn_nitrogen_df %>%
  group_by(nitro) %>%
  summarise(
    mean_yield = mean(yield, na.rm = TRUE),
    .groups = "drop"
  )

# Plot: nitrogen vs. average corn yield
ggplot(corn_summary, aes(x = nitro, y = mean_yield)) +
  geom_line(color = "#1f77b4", size = 1) +
  geom_point(size = 2, color = "#1f77b4") +
  labs(
    title = "Corn Yield by Nitrogen Level",
    x = "Nitrogen Level (kg/ha)",
    y = "Average Yield (quintals/ha)"
  ) +
  theme_minimal()

Dataset Suffixes

Each dataset in ArgentinAPI is labeled with a suffix to indicate its structure and type:

Datasets Included in ArgentinAPI

In addition to API access functions, ArgentinAPI provides several preloaded datasets offering insights into Argentina’s economic, agricultural, demographic, and genetic indicators. Here are some featured examples:

Conclusion

The ArgentinAPI package provides a powerful suite of tools to access public data from Argentina through curated datasets and API connectors. Whether analyzing economic trends, exploring georeferenced crop productivity, or studying population genetics, this package enables rich, reproducible analysis rooted in official and scientifically valuable data.