This function imports and cleans raw toxic release data,
returning a single SpatVector (points) object for the selected year.
Usage
process_tri(
path = NULL,
year = 2018,
variables = "STACK_AIR",
chemical = NULL,
industry_group = c("none", "industry_sector", "industry_sector_code", "both"),
ignore_case = TRUE,
extent = NULL,
...
)Arguments
- path
character(1). Path to the directory with TRI CSV files
- year
integer(1). Single year to select.
- variables
character. One or more regular expressions used to select TRI release variables by column name after normalization to underscore naming (for example,
STACK_AIR,FUGITIVE_AIR,WATER). Default is"STACK_AIR". Matching first uses raw TRI column names, then falls back to a normalized match where punctuation and spaces are converted to underscores (for example,"ON-SITE RELEASE TOTAL"matchesON_SITE_RELEASE_TOTAL). Recommended options include:FUGITIVE_AIRSTACK_AIRWATERUNDERGROUNDUNDERGROUND_CL_IUNDERGROUND_C_II_VLANDFILLSRCRA_C_LANDFILLOTHER_LANDFILLSLAND_TREATMENTSURFACE_IMPNDMNTRCRA_SURFACE_IMOTHER_SURFACE_IOTHER_DISPOSALON_SITE_RELEASE_TOTALPOTW_TRNS_RLSEPOTW_TRNS_TRTPOTW_TOTAL_TRANSFERS
- chemical
NULLor character. Optional one or more regular expressions used to filter chemicals. Patterns are matched againstTRI_CHEMICAL_COMPOUND_ID,CHEMICAL, andCAS/CAS.values. IfNULL(default), all chemicals are retained.- industry_group
character(1). Optional additional grouping level. One of
"none"(default),"industry_sector","industry_sector_code", or"both".- ignore_case
logical(1). If
TRUE(default), regular expression matching invariablesandchemicalis case-insensitive.- extent
numeric(4) or SpatExtent giving the extent of the raster if
NULL(default), the entire raster is loaded- ...
Placeholders.
Note
Use get_tri_info() to inspect
available TRI chemical IDs/names/CAS numbers and industry sector codes in
local TRI files. Visit TRI Data and Tools
to view the available years and variables.
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{
tri <- process_tri(
path = "./data",
year = 2020,
variables = c("STACK_AIR", "FUGITIVE_AIR"),
chemical = "benzene",
industry_group = "industry_sector"
)
} # }