The process_aqs()
function cleans and imports raw air quality
monitoring sites from pre-generated daily CSV files, returning a single
SpatVector
or sf
object.
date
is used to filter the raw data read from csv files.
Filtered rows are then processed according to mode
argument.
Some sites report multiple measurements per day with and without
exceptional events
the internal procedure of this function keeps "Included" if there
are multiple event types per site-time.
Arguments
- path
character(1). Directory path to daily measurement data.
- date
character(1 or 2). Date (1) or start and end dates (2). Should be in
"YYYY-MM-DD"
format and sorted.- mode
character(1). One of
"date-location" (all dates * all locations)
"available-data" (date-location pairs with available data)
"location" (unique locations).
- data_field
character(1). Data field to extract.
- return_format
character(1).
"terra"
or"sf"
or"data.table"
.- extent
numeric(4). Spatial extent of the resulting object. The order should be
c(xmin, xmax, ymin, ymax)
. The coordinate system should be WGS84 (EPSG:4326).- ...
Placeholders.
Note
Choose date
and mode
values with caution.
The function may return a massive data.table depending on the time range,
resulting in a long processing time or even a crash if data is too large
for your computing environment to process.
Examples
## NOTE: Example is wrapped in `\dontrun{}` as function requires a large
## amount of data which is not included in the package.
if (FALSE) { # \dontrun{
aqs <- process_aqs(
path = "./data/aqs_daily_example.csv",
date = c("2022-12-01", "2023-01-31"),
mode = "full",
return_format = "terra"
)
} # }