MyNixOS website logo
Description

Access Mexican Data via APIs and Curated Datasets.

Provides functions to access data from public RESTful APIs including 'REST Countries API', 'World Bank API', and 'Nager.Date API', covering Mexico's economic indicators, population statistics, literacy rates, international geopolitical information and official public holidays. The package also includes curated datasets related to Mexico such as air quality monitoring stations, pollution zones, income surveys, postal abbreviations, election studies, forest productivity and demographic data by state. It supports research and analysis focused on Mexico by integrating reliable global APIs with structured national datasets drawn from open and academic sources. For more information on the APIs, see: 'REST Countries API' <https://restcountries.com/>, 'World Bank API' <https://datahelpdesk.worldbank.org/knowledgebase/articles/889392>, and 'Nager.Date API' <https://date.nager.at/Api>.

MexicoDataAPI

The MexicoDataAPI package provides a unified interface to access open data from the World Bank API, REST Countries API, and Nager.Date API, with a focus on Mexico. It allows users to retrieve up-to-date information on topics such as economic indicators, population figures, literacy rates, unemployment levels, basic geopolitical information, and official public holidays.

In addition to API-access functions, the package includes a set of curated datasets related to Mexico. These cover areas such as air quality monitoring, state-level income surveys, postal abbreviations, election results, and regional forest classification.

Installation

You can install the MexicoDataAPI package from CRAN with the following R function:


install.packages("MexicoDataAPI")

Usage

After installation, load the package and start exploring and using its functions and datasets.


library(MexicoDataAPI)

MexicoDataAPI Functions

  • get_country_info_mx(): Get Key Country Information about Mexico from the REST Countries API

  • get_mexico_cpi(): Get Mexico's Consumer Price Index (2010 = 100) from World Bank

  • get_mexico_gdp(): Get Mexico's GDP (Current US$) from World Bank

  • get_mexico_holidays(): Get official public holidays in Mexico for a given year, e.g., get_mexico_holidays(2025).

  • get_mexico_life_expectancy(): Get Mexico's Life Expectancy from World Bank

  • get_mexico_literacy_rate(): Get Mexico's Literacy Rate (Age 15+) from World Bank

  • get_mexico_population(): Get Mexico's Population (Total) from World Bank

  • get_mexico_unemployment(): Get Mexico's Unemployment Rate (%) from World Bank

  • view_datasets_MexicoDataAPI(): Lists all curated datasets included in the MexicoDataAPI package

Dataset Suffixes

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

  • _df: A standard data frame.

  • _tbl_df: A tibble data frame object.

  • _chr: A character object.

Datasets Included in MexicoDataAPI

In addition to API access functions, MexicoDataAPI provides several preloaded datasets related to Mexico’s environment, demographics, and public data. Here are some featured examples:

  • mexico_elections_df: Data frame containing a subset of the 2012 Mexico Elections Panel Study.

  • mex_income_2016_tbl_df: Tibble containing household-level income data and associated demographic characteristics from the 2016 ENIGH (Household Income and Expenditure Survey).

  • mexico_abb_chr: Character vector containing the official two- or three-letter postal abbreviations for the 32 federal entities of Mexico.

Example Code:


# Load the package
library(MexicoDataAPI)

# Selected, essential information about Mexico
get_country_info_mx()

# Get Mexico's Population (Total) from World Bank
get_mexico_population()

# Load a dataset
data("mex_income_2016_tbl_df")

# Shows six rows of the dataset
head(mex_income_2016_tbl_df)

# Display the structure of the dataset
str(mex_income_2016_tbl_df)

# Shows the whole dataset

View(mex_income_2016_tbl_df)


Metadata

Version

0.2.0

License

Unknown

Platforms (76)

    Darwin
    FreeBSD
    Genode
    GHCJS
    Linux
    MMIXware
    NetBSD
    none
    OpenBSD
    Redox
    Solaris
    WASI
    Windows
Show all
  • aarch64-darwin
  • aarch64-freebsd
  • aarch64-genode
  • aarch64-linux
  • aarch64-netbsd
  • aarch64-none
  • aarch64-windows
  • aarch64_be-none
  • arm-none
  • armv5tel-linux
  • armv6l-linux
  • armv6l-netbsd
  • armv6l-none
  • armv7a-linux
  • armv7a-netbsd
  • armv7l-linux
  • armv7l-netbsd
  • avr-none
  • i686-cygwin
  • i686-freebsd
  • i686-genode
  • i686-linux
  • i686-netbsd
  • i686-none
  • i686-openbsd
  • i686-windows
  • javascript-ghcjs
  • loongarch64-linux
  • m68k-linux
  • m68k-netbsd
  • m68k-none
  • microblaze-linux
  • microblaze-none
  • microblazeel-linux
  • microblazeel-none
  • mips-linux
  • mips-none
  • mips64-linux
  • mips64-none
  • mips64el-linux
  • mipsel-linux
  • mipsel-netbsd
  • mmix-mmixware
  • msp430-none
  • or1k-none
  • powerpc-linux
  • powerpc-netbsd
  • powerpc-none
  • powerpc64-linux
  • powerpc64le-linux
  • powerpcle-none
  • riscv32-linux
  • riscv32-netbsd
  • riscv32-none
  • riscv64-linux
  • riscv64-netbsd
  • riscv64-none
  • rx-none
  • s390-linux
  • s390-none
  • s390x-linux
  • s390x-none
  • vc4-none
  • wasm32-wasi
  • wasm64-wasi
  • x86_64-cygwin
  • x86_64-darwin
  • x86_64-freebsd
  • x86_64-genode
  • x86_64-linux
  • x86_64-netbsd
  • x86_64-none
  • x86_64-openbsd
  • x86_64-redox
  • x86_64-solaris
  • x86_64-windows