Installing package

if(!require(remotes)){install.packages('remotes'); require(remotes)}
remotes::install_github("energyandcleanair/rcrea")
library(rcrea)

Measurements

Downloading measurements

Collecting measurements at the city level:

meas_cities <- rcrea::measurements(city=c('Jaipur','Mumbai', 'Delhi'),
                                   source="cpcb",
                                   poll=c(rcrea::NO2, rcrea::PM25),
                                   date_from="2020-01-01")
meas_cities

Getting data at the station level (i.e. more granular than city).

meas_stations <- rcrea::measurements(city=c('Beijing'),
                                     source="mee",
                                     aggregate_level = "station",
                                     poll=rcrea::NO2,
                                     date_from="2018-01-01")
meas_stations

Plotting measurements

rcrea::plot_recents(meas_raw=meas_cities,
                    subplot_by="poll",
                    color_by="location_name",
                    running_days = 30)
rcrea::plot_recents(meas_raw=meas_stations,
                    subplot_by="location_id",
                    color_by="year",
                    running_days = 30)

Heatmap of standardized air quality level:

rcrea::plot_measurements(meas_cities,
                         poll=PM25,
                         subplot_by='location_name',
                         type='heatmap',
                         average_by='day')


hubert-thieriot/crea_r_package documentation built on June 11, 2025, 11:31 p.m.