Retrieve hourly averages, daily maximums, or daily minimums of pollution data in the original units, by station, from the air quality server at Consulta de Concentraciones

get_station_month_data(criterion, pollutant, year, month)



Type of data to download.

  • "HORARIOS" - Hourly data

  • "MAXIMOS"" - Daily maximums

  • "MINIMOS" - Daily minimums


The type of pollutant to download.

  • "SO2" - Sulfur Dioxide (parts per billion)

  • "CO" - Carbon Monoxide (parts per million)

  • "NOX" - Nitrogen Oxides (parts per billion)

  • "NO2" - Nitrogen Dioxide (parts per billion)

  • "NO" - Nitric Oxide (parts per billion)

  • "O3" - Ozone (parts per billion)

  • "PM10" - Particulate matter 10 micrometers or less (micrograms per cubic meter)

  • "PM25" - Particulate matter 2.5 micrometers or less (micrograms per cubic meter)

  • "WSP" - Wind velocity (meters per second)

  • "WDR" - Wind direction (degrees)

  • "TMP" - Temperature (degrees Celsius)

  • "RH" - Relative humidity (percentage)


an integer indicating the year for which to download data (the earliest possible value is 1986)


month number to download


A data.frame with pollution data, the hours correspond to the Etc/GMT+6 timezone, with no daylight saving time


Temperature (TMP) data was rounded to the nearest integer, but the get_station_data function allows you to download data accurate to one decimal point in some cases (i.e. for old data).


The data for the current month is in the process of being validated

See also

stations for a data.frame with the location and names of all pollution measuring stations

Other raw data functions: get_station_data


if (FALSE) { ## Download daily hourly PM10 data (particulate matter 10 micrometers or ## less in diameter) from March 2016 df_pm10 <- get_station_month_data("HORARIOS", "PM10", 2016, 3) head(df_pm10) ## Download daily hourly O3 data from October 2017 df_o3 <- get_station_month_data("HORARIOS", "O3", 2018, 1) ## Convert to local Mexico City time df_o3$mxc_time <- format(as.POSIXct(paste0(df_o3$date, " ", df_o3$hour, ":00"), tz = "Etc/GMT+6"), tz = "America/Mexico_City") head(df_o3) }