ArgentinAPI: Access Argentinian Data via 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 comprehensive and unified interface to access open data about Argentina from multiple public RESTful APIs, including ArgentinaDatos API, REST Countries API, and World Bank API. Through these sources, users can easily retrieve information on exchange rates, inflation, political figures, national holidays, economic indicators, and general country-level statistics.

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

By integrating open APIs with high-quality datasets from multiple domains, ArgentinAPI supports research, teaching, and analysis focused on Argentina, making it a versatile tool for academics, professionals, and policymakers.

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, REST Countries, and the World Bank API.

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 583   Almeida, Romina María          Entre Ríos Alianz… 2025-12-10 2031-12-09
#>  2 584   Bahl, Adán Humberto            Entre Ríos Fuerza… 2025-12-10 2031-12-09
#>  3 582   Benegas Lynch, Joaquín Alberto Entre Ríos Alianz… 2025-12-10 2031-12-09
#>  4 580   Bullrich, Patricia             Ciudad Au… Alianz… 2025-12-10 2031-12-09
#>  5 285   Capitanich, Jorge Milton       Chaco      Fuerza… 2025-12-10 2031-12-09
#>  6 586   Cervi, Mario Pablo             Neuquén    Alianz… 2025-12-10 2031-12-09
#>  7 587   Corroza, Julieta               Neuquén    la Neu… 2025-12-10 2031-12-09
#>  8 595   Coto, Agustín Pedro            Tierra de… Alianz… 2025-12-10 2031-12-09
#>  9 578   Godoy, Juan Cruz               Chaco      Alianz… 2025-12-10 2031-12-09
#> 10 592   Guzmán Coraita, Gonzalo        Salta      Alianz… 2025-12-10 2031-12-09

Argentina’s GDP (Current US$) from World Bank 2022 - 2017



argentina_gdp <- head(get_argentina_gdp())

print(argentina_gdp)
#> # A tibble: 6 × 5
#>   indicator         country    year         value value_label    
#>   <chr>             <chr>     <int>         <dbl> <chr>          
#> 1 GDP (current US$) Argentina  2022 633993756301. 633,993,756,301
#> 2 GDP (current US$) Argentina  2021 486564085480. 486,564,085,480
#> 3 GDP (current US$) Argentina  2020 385740508437. 385,740,508,437
#> 4 GDP (current US$) Argentina  2019 447754683615. 447,754,683,615
#> 5 GDP (current US$) Argentina  2018 524819892360. 524,819,892,360
#> 6 GDP (current US$) Argentina  2017 643628393281. 643,628,393,281

Argentina’s Life Expectancy at Birth from World Bank 2022 - 2017


argentina_life_expectancy <- head(get_argentina_life_expectancy())

print(argentina_life_expectancy)
#> # A tibble: 6 × 4
#>   indicator                               country    year value
#>   <chr>                                   <chr>     <int> <dbl>
#> 1 Life expectancy at birth, total (years) Argentina  2022  75.8
#> 2 Life expectancy at birth, total (years) Argentina  2021  73.9
#> 3 Life expectancy at birth, total (years) Argentina  2020  75.9
#> 4 Life expectancy at birth, total (years) Argentina  2019  76.8
#> 5 Life expectancy at birth, total (years) Argentina  2018  76.8
#> 6 Life expectancy at birth, total (years) Argentina  2017  76.5

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 brings together public RESTful APIs—including ArgentinaDatos, REST Countries, and the World Bank API—with a collection of curated datasets covering domains such as economic indicators, biodiversity, agriculture, human rights, genetic data, and consumer prices.

By integrating these diverse sources, the package enables comprehensive, reproducible, and high-quality research and analysis focused on Argentina. Whether the goal is to study macroeconomic trends, evaluate environmental and agricultural data, or explore social and genetic indicators, ArgentinAPI provides a versatile and reliable toolkit for researchers, educators, policymakers, and data enthusiasts.