Fork me on GitHub

The package also has special functions to download data from the INEGI API using the inegiR package

  1. You must have a token to use this functionality. It’s free and easy to get by visiting the INEGI website
  2. The function plots the most recent value provided by the API
  3. You’ll have to lookup the indicator code at the INEGI

the data can take a while to download and by defaut the choropleth functions will show you an estimate of how much time is remaining for the downloads to finish. If you do not want this behavior set the silent parameter to TRUE

library(mxmaps)

# Insert token here
# If you don't have a token you can get one from: http://www3.inegi.org.mx//sistemas/api/indicadores/v1/tokenVerify.aspx
token <- ""

mxc_regions <- subset(df_mxmunicipio, metro_area == "Valle de México")$region
choropleth_inegi(token, mxc_regions, 
                 indicator = "1006000044", 
                 silent = FALSE)
## 
Downloading data from the INEGI API

state_regions <- df_mxstate$region
choropleth_inegi(token, state_regions, 
                 indicator = "3101008001")
## 
Downloading data from the INEGI API

hexbin_inegi(token, state_regions, 
             indicator = "3106002001")
## 
Downloading data from the INEGI API