Title: | Calculate Aquatic Life Benchmarks |
---|---|
Description: | Download recent versions of the US EPA ECOTOX database. Clean, standardize and classify data so values are comparable. Use a SSD or deterministic method to determine the critical toxicity value and assessment factors to compute the aquatic life water quality benchmark for a compound. |
Authors: | Ayla Pearson [aut] , Angeline Tillmanns [aut, cre], Joe Thorley [ctb] , Andy Teucher [ctb] , Province of British Columbia [cph] |
Maintainer: | Angeline Tillmanns <[email protected]> |
License: | Apache License (== 2) |
Version: | 0.3.0 |
Built: | 2024-11-22 01:24:25 UTC |
Source: | https://github.com/poissonconsulting/wqbench |
Internal to allow for testing
combine_bc_species(bc_species, db_species)
combine_bc_species(bc_species, db_species)
bc_species |
A data frame |
db_species |
A data frame |
A data frame
## Not run: data <- combine_bc_species(bc_species, db_species) ## End(Not run)
## Not run: data <- combine_bc_species(bc_species, db_species) ## End(Not run)
Internal to allow for testing
combine_bc_wqg(bc_wqg, db_chemicals)
combine_bc_wqg(bc_wqg, db_chemicals)
bc_wqg |
A data frame |
db_chemicals |
A data frame |
A data frame
## Not run: data <- combine_bc_wqg(bc_wqg, db_chemicals) ## End(Not run)
## Not run: data <- combine_bc_wqg(bc_wqg, db_chemicals) ## End(Not run)
Internal to allow for testing
combine_conc_conversions(concentration_std, db_concentration_unit_codes)
combine_conc_conversions(concentration_std, db_concentration_unit_codes)
concentration_std |
A data frame |
db_concentration_unit_codes |
A data frame |
A data frame
## Not run: data <- combine_conc_conversions( concentration_std, db_concentration_unit_codes ) ## End(Not run)
## Not run: data <- combine_conc_conversions( concentration_std, db_concentration_unit_codes ) ## End(Not run)
Internal to allow for testing
combine_concentration_endpoints(endpoint_concentration_pick, db_endpoint_code)
combine_concentration_endpoints(endpoint_concentration_pick, db_endpoint_code)
endpoint_concentration_pick |
A data frame |
db_endpoint_code |
A data frame |
A data frame
## Not run: data <- combine_concentration_endpoints( endpoint_concentration_pick, db_endpoint_code ) ## End(Not run)
## Not run: data <- combine_concentration_endpoints( endpoint_concentration_pick, db_endpoint_code ) ## End(Not run)
Internal to allow for testing
combine_duration_conversions(duration_std, db_duration_unit_codes)
combine_duration_conversions(duration_std, db_duration_unit_codes)
duration_std |
A data frame |
db_duration_unit_codes |
A data frame |
A data frame
## Not run: duration_unit_codes_std <- combine_duration_conversions( duration_std, db_duration_unit_codes ) ## End(Not run)
## Not run: duration_unit_codes_std <- combine_duration_conversions( duration_std, db_duration_unit_codes ) ## End(Not run)
Internal to allow for testing
combine_lifestage(lifestage_codes, db_lifestage_codes)
combine_lifestage(lifestage_codes, db_lifestage_codes)
lifestage_codes |
A data frame |
db_lifestage_codes |
A data frame |
A data frame
## Not run: lifestage_groups <- combine_lifestage(lifestage_codes, db_lifestage_codes) ## End(Not run)
## Not run: lifestage_groups <- combine_lifestage(lifestage_codes, db_lifestage_codes) ## End(Not run)
Internal to allow for testing
combine_media(db_media_type)
combine_media(db_media_type)
db_media_type |
A data frame |
A data frame
## Not run: media_type <- combine_media(db_media_type) ## End(Not run)
## Not run: media_type <- combine_media(db_media_type) ## End(Not run)
Internal to allow for testing
combine_trophic_group(trophic_groups, db_species)
combine_trophic_group(trophic_groups, db_species)
trophic_groups |
A data frame |
db_species |
A data frame |
A data frame
## Not run: species_trophic_group <- combine_trophic_group(trophic_groups, db_species) ## End(Not run)
## Not run: species_trophic_group <- combine_trophic_group(trophic_groups, db_species) ## End(Not run)
Internal to wqb_join_data() to allow for testing.
join_data( db_results, db_tests, db_endpoint_codes, db_species, db_lifestage_codes, db_chemicals, db_duration_unit_codes, db_concentration_unit_codes, db_references, db_effect_codes, db_media_type_codes, db_meta_data_download )
join_data( db_results, db_tests, db_endpoint_codes, db_species, db_lifestage_codes, db_chemicals, db_duration_unit_codes, db_concentration_unit_codes, db_references, db_effect_codes, db_media_type_codes, db_meta_data_download )
db_results |
A data frame |
db_tests |
A data frame |
db_endpoint_codes |
A data frame |
db_species |
A data frame |
db_lifestage_codes |
A data frame |
db_chemicals |
A data frame |
db_duration_unit_codes |
A data frame |
db_concentration_unit_codes |
A data frame |
db_references |
A data frame |
db_effect_codes |
A data frame |
db_media_type_codes |
A data frame |
db_meta_data_download |
A data frame |
Invisible data frame
## Not run: data <- wqb_join_data( db_results, db_tests, db_endpoint_codes, db_species, db_lifestage_codes, db_chemicals, db_duration_unit_codes, db_concentration_unit_codes, db_references, db_effect_codes, db_media_type_codes, db_meta_data_download ) ## End(Not run)
## Not run: data <- wqb_join_data( db_results, db_tests, db_endpoint_codes, db_species, db_lifestage_codes, db_chemicals, db_duration_unit_codes, db_concentration_unit_codes, db_references, db_effect_codes, db_media_type_codes, db_meta_data_download ) ## End(Not run)
Internal to allow for testing
read_bc_species(bc_species_file_path, db_species)
read_bc_species(bc_species_file_path, db_species)
bc_species_file_path |
A file path |
db_species |
A data frame |
A data frame
## Not run: data <- read_bc_species(bc_species_file_path, db_species) ## End(Not run)
## Not run: data <- read_bc_species(bc_species_file_path, db_species) ## End(Not run)
Internal to allow for testing
read_bc_wqg(db_chemicals)
read_bc_wqg(db_chemicals)
db_chemicals |
A data frame |
A data frame
## Not run: chemicals_bc_wqg <- read_bc_wqg(db_chemicals) ## End(Not run)
## Not run: chemicals_bc_wqg <- read_bc_wqg(db_chemicals) ## End(Not run)
Internal to allow for testing
read_conc_conversions(concentration_std_file_path, db_concentration_unit_codes)
read_conc_conversions(concentration_std_file_path, db_concentration_unit_codes)
concentration_std_file_path |
A file path |
db_concentration_unit_codes |
A data frame |
A data frame
## Not run: concentration_unit_codes_std <- read_conc_conversions( concentration_std_file_path, db_concentration_unit_codes ) ## End(Not run)
## Not run: concentration_unit_codes_std <- read_conc_conversions( concentration_std_file_path, db_concentration_unit_codes ) ## End(Not run)
Internal to allow for testing
read_concentration_endpoints(conc_endpoints_file_path, db_endpoint_code)
read_concentration_endpoints(conc_endpoints_file_path, db_endpoint_code)
conc_endpoints_file_path |
A file path |
db_endpoint_code |
A data frame |
A data frame
## Not run: endpoint_concentration <- read_concentration_endpoints( conc_endpoints_file_path, db_endpoint_code ) ## End(Not run)
## Not run: endpoint_concentration <- read_concentration_endpoints( conc_endpoints_file_path, db_endpoint_code ) ## End(Not run)
Internal to allow for testing
read_duration_conversions(duration_std_file_path, db_duration_unit_codes)
read_duration_conversions(duration_std_file_path, db_duration_unit_codes)
duration_std_file_path |
A file path |
db_duration_unit_codes |
A data frame |
A data frame
## Not run: duration_unit_codes_std <- read_duration_conversions( duration_std_file_path, db_duration_unit_codes ) ## End(Not run)
## Not run: duration_unit_codes_std <- read_duration_conversions( duration_std_file_path, db_duration_unit_codes ) ## End(Not run)
Internal to allow for testing
read_lifestage(lifestage_file_path, db_lifestage_codes)
read_lifestage(lifestage_file_path, db_lifestage_codes)
lifestage_file_path |
A data frame |
db_lifestage_codes |
A data frame |
A data frame
## Not run: lifestage_groups <- read_lifestage(lifestage_file_path, db_lifestage_codes) ## End(Not run)
## Not run: lifestage_groups <- read_lifestage(lifestage_file_path, db_lifestage_codes) ## End(Not run)
Internal to allow for testing
read_trophic_group(trophic_groups_file_path, db_species)
read_trophic_group(trophic_groups_file_path, db_species)
trophic_groups_file_path |
A file path |
db_species |
A data frame |
A data frame
## Not run: species_trophic_group <- read_trophic_group(trophic_groups_file_path, db_species) ## End(Not run)
## Not run: species_trophic_group <- read_trophic_group(trophic_groups_file_path, db_species) ## End(Not run)
Template for Adding your own Data
template
template
A data.frame with columns:
Row description.
The latin name of the test species.
Toxicity endpoint.
The effect that was being tested.
The lifestage the species was during the test.
Contaminant concentration that corresponds to the endpoint.
The effect concentration standardized to include the acute to chronic ratio to extrapolate acute and/or effect concentrations to chronic and/or no-effect concentrations in mg/L.
Trophic group of species.
Identification of salmonids and planktonic invertebrates. If neither of these, listed as “other”.
Species is present in British Columbia if entry = TRUE
Read in a list of British Columbia species and add a column to the species
table in the database to indicate if the species is present in British
Columbia.
wqb_add_bc_species(database, quiet = FALSE)
wqb_add_bc_species(database, quiet = FALSE)
database |
A string to the location of the database. |
quiet |
Turn off message when quiet set to TRUE. |
The BC species data is contained in a csv file in the extdata folder
of the package. This file can be edited by adding new species or removing
species. Do not add new columns, rename columns or rename the file. The
file must only contain a single column named latin_name
.
The latin_name
column must consist of the genus and species separated by
a space. The latin_name
column in the bc-species.csv file is matched to
the latin_name
column in the species table of the database. A new column
species_present_in_bc
is added to the species table that codes each
species as TRUE if it matches a value in the bc-species.csv or FALSE if
there is no match.
Invisible data frame
## Not run: bc_species <- wqb_add_bc_species( database = "ecotox_ascii_09_15_2022.sqlite" ) bc_species <- wqb_add_bc_species( database = "ecotox_db/ecotox_ascii_09_15_2022.sqlite" ) ## End(Not run)
## Not run: bc_species <- wqb_add_bc_species( database = "ecotox_ascii_09_15_2022.sqlite" ) bc_species <- wqb_add_bc_species( database = "ecotox_db/ecotox_ascii_09_15_2022.sqlite" ) ## End(Not run)
Read in the British Columbia water quality guidelines (wqg) and add a column to the chemicals tables in the database to indicate if the chemical is present in the British Columbia water quality guidelines.
wqb_add_bc_wqg(database, quiet = FALSE)
wqb_add_bc_wqg(database, quiet = FALSE)
database |
A string to the location of the database. |
quiet |
Turn off message when quiet set to TRUE. |
The wqg data is stored in the BC Data Catalogue.
The CAS_number
column in the bc wqg data is matched to the cas_number
column in the chemicals table of the database. A new column
present_in_bc_wqg
is added to the chemicals table that codes each
chemical as TRUE if the chemical is present in wqg or FALSE if the chemical
is not present in wqg.
Invisible data frame
## Not run: chem_bc_wqg <- wqb_add_bc_wqg( database = "ecotox_ascii_09_15_2022.sqlite" ) chem_bc_wqg <- wqb_add_bc_wqg( database = "ecotox_db/ecotox_ascii_09_15_2022.sqlite" ) ## End(Not run)
## Not run: chem_bc_wqg <- wqb_add_bc_wqg( database = "ecotox_ascii_09_15_2022.sqlite" ) chem_bc_wqg <- wqb_add_bc_wqg( database = "ecotox_db/ecotox_ascii_09_15_2022.sqlite" ) ## End(Not run)
Read in the concentration-conversion file and code units that can be converted and which ones will be removed. Three columns will be added to the concentration_unit_codes table in the database, indicate which units are being kept, the conversion factor, and the units it is being converted to. Currently units are converted to mg/L or equivalent.
wqb_add_conc_conversions(database, quiet = FALSE)
wqb_add_conc_conversions(database, quiet = FALSE)
database |
A string to the location of the database. |
quiet |
Turn off message when quiet set to TRUE. |
The list of units to be converted are contained in a csv file in the
extdata folder of the package. The csv file can be edited by adding or
removing rows. To add new rows get the code
and description
values
from the concentration_unit_codes
table in the database and paste them
into the csv file.
Do not add new columns, rename columns or rename the file. The file must
only contain the columns: code
, description
, conc_conversion_flag
,
conc_conversion_value_multiplier
and conc_conversion_unit
.
The conc_conversion_flag
column indicates which units are being converted
and which are being removed because they can not be converted or are not in
the aquatic portion of the data.The conc_conversion_value_multiplier
column contains the value need to convert the unit into the unit listed in
the conc_conversion_unit
column.
The code
values in the concentration-conversion file are matched to the
code
values in the concentration_unit_codes
table in the database.
Invisible data frame
## Not run: concentration_unit_code_standardization <- wqb_add_conc_conversions( database = "ecotox_ascii_09_15_2022.sqlite" ) concentration_unit_code_standardization <- wqb_add_conc_conversions( database = "ecotox_db/ecotox_ascii_09_15_2022.sqlite" ) ## End(Not run)
## Not run: concentration_unit_code_standardization <- wqb_add_conc_conversions( database = "ecotox_ascii_09_15_2022.sqlite" ) concentration_unit_code_standardization <- wqb_add_conc_conversions( database = "ecotox_db/ecotox_ascii_09_15_2022.sqlite" ) ## End(Not run)
Read in the concentration endpoints that have been selected to keep in the final data set. Add a column to the endpoint_codes table in the database to mark the corresponding endpoints.
wqb_add_concentration_endpoints(database, quiet = FALSE)
wqb_add_concentration_endpoints(database, quiet = FALSE)
database |
A string to the location of the database. |
quiet |
Turn off message when quiet set to TRUE. |
The list of concentration endpoints is contained in a csv file in
the extdata folder of the package. The csv file can be edited by adding or
removing rows. To add new rows get the code
and description
values
from the endpoint_codes
table in the database and paste them into the csv
file.
Do not add new columns, rename columns or rename the file. The file must
only contain the code
and description
column.
The code
values in the endpoint-concentration file are matched to the
code
values in the endpoint_code table in the database. A new column
concentration_flag
is added to the endpoint_code table that codes each
endpoint as TRUE if the endpoint is present in endpoint-concentration.csv
file.
Invisible data frame
## Not run: wqb_add_concentration_endpoints( database = "ecotox_ascii_09_15_2022.sqlite" ) wqb_add_concentration_endpoints( database = "ecotox_db/ecotox_ascii_09_15_2022.sqlite" ) ## End(Not run)
## Not run: wqb_add_concentration_endpoints( database = "ecotox_ascii_09_15_2022.sqlite" ) wqb_add_concentration_endpoints( database = "ecotox_db/ecotox_ascii_09_15_2022.sqlite" ) ## End(Not run)
Read in the duration-conversion file and code unit values that can be converted and which ones will be removed. Two columns will be added to the duration_unit_codes table in the database to indicate which units are being kept and the conversion factor. Currently duration units are converted to hours.
wqb_add_duration_conversions(database, quiet = FALSE)
wqb_add_duration_conversions(database, quiet = FALSE)
database |
A string to the location of the database. |
quiet |
Turn off message when quiet set to TRUE. |
The list of units to be converted are contained in a csv file in the
extdata folder of the package. The csv file can be edited by adding or
removing rows. To add new rows get the code
and description
values
from the duration_unit_codes
table in the database and paste them into
the csv file.
Do not add new columns, rename columns or rename the file. The file must
only contain the columns: code
, description
, duration_units_to_keep
and duration_value_multiplier_to_hours
.
The code
values in the duration-conversion file are matched to the code
values in the duration_unit_codes
table in the database.
The duration_units_to_keep
column indicates which units are being
converted and which are being removed because they can not be converted or
are not in the aquatic portion of the data. The
duration_value_multiplier_to_hours
column contains the value need to
convert the unit into hours.
Invisible data frame
## Not run: duration_unit_code_standardization <- wqb_add_duration_conversions( database = "ecotox_ascii_09_15_2022.sqlite" ) duration_unit_code_standardization <- wqb_add_duration_conversions( database = "ecotox_db/ecotox_ascii_09_15_2022.sqlite" ) ## End(Not run)
## Not run: duration_unit_code_standardization <- wqb_add_duration_conversions( database = "ecotox_ascii_09_15_2022.sqlite" ) duration_unit_code_standardization <- wqb_add_duration_conversions( database = "ecotox_db/ecotox_ascii_09_15_2022.sqlite" ) ## End(Not run)
Read in the life stage simple groups and add a column in the lifestage_code table in the database to mark the corresponding values.
wqb_add_lifestage(database, quiet = FALSE)
wqb_add_lifestage(database, quiet = FALSE)
database |
A string to the location of the database. |
quiet |
Turn off message when quiet set to TRUE. |
Only life stages related to fish or amphibians have been coded. The purpose of the coding is to be able to simplify the many life stages into three categories: els (early life stage), juveniles and adults. Not all life stages have been coded into these three groups.
The life stage data is contained in a csv file in the extdata folder of the
package. The csv file can be edited by adding or removing rows. To add new
rows get the code
and description
values from the lifestage_code
table in the dataset and paste them into the csv file and then add the
value to the simple_lifestage
column.
Do not add new columns, rename columns or rename the file. The file must
only contain the code
, description_lifestage
and simple_lifestage
column.
The code
values in the lifestage-codes.csv file are matched to the code
values in the lifestage_code table in the database. Any codes
that match are coded in a new column called simple_lifestage
.
Invisible data frame
## Not run: lifestage_codes <- wqb_add_lifestage( database = "ecotox_ascii_09_15_2022.sqlite" ) lifestage_codes <- wqb_add_lifestage( database = "ecotox_db/ecotox_ascii_09_15_2022.sqlite" ) ## End(Not run)
## Not run: lifestage_codes <- wqb_add_lifestage( database = "ecotox_ascii_09_15_2022.sqlite" ) lifestage_codes <- wqb_add_lifestage( database = "ecotox_db/ecotox_ascii_09_15_2022.sqlite" ) ## End(Not run)
Code the media type information into three categories: salt water, fresh water and not reported.
wqb_add_media(database, quiet = FALSE)
wqb_add_media(database, quiet = FALSE)
database |
A string to the location of the database. |
quiet |
Turn off message when quiet set to TRUE. |
Read in the media_type_codes table from the database and code the 24
groups into three categories: salt water, fresh water or not reported. The
new categories are added to a column in the table called
media_type_group
.
Invisible data frame
## Not run: media_info <- wqb_add_media( database = "ecotox_ascii_09_15_2022.sqlite" ) media_info <- wqb_add_media( database = "ecotox_db/ecotox_ascii_09_15_2022.sqlite" ) ## End(Not run)
## Not run: media_info <- wqb_add_media( database = "ecotox_ascii_09_15_2022.sqlite" ) media_info <- wqb_add_media( database = "ecotox_db/ecotox_ascii_09_15_2022.sqlite" ) ## End(Not run)
Read in the trophic and ecological groups and and add a column to the
species
table in the database that lists the groups for each species.
wqb_add_trophic_group(database, quiet = FALSE)
wqb_add_trophic_group(database, quiet = FALSE)
database |
A string to the location of the database. |
quiet |
Turn off message when quiet set to TRUE. |
The trophic group data is contained in a csv file in the extdata folder of the package. This file can be edited by adding or removing groups and classes. Do not add new columns, rename columns or rename the file.
The trophic groups file must contain the columns: class
, order
,
trophic_group
, and ecological_group
. The class
and order
columns are matched to the class
and tax_order
columns in the species
table of the database and then adds the trophic_group
and
ecological_group
columns to the species table.
Invisible data frame
## Not run: trophic_group <- wqb_add_trophic_group( database = "ecotox_ascii_09_15_2022.sqlite" ) trophic_group <- wqb_add_trophic_group( database = "ecotox_db/ecotox_ascii_09_15_2022.sqlite" ) ## End(Not run)
## Not run: trophic_group <- wqb_add_trophic_group( database = "ecotox_ascii_09_15_2022.sqlite" ) trophic_group <- wqb_add_trophic_group( database = "ecotox_db/ecotox_ascii_09_15_2022.sqlite" ) ## End(Not run)
Determines the species variation factor, ecological assessment factor and B.C. species factor.
wqb_af(data)
wqb_af(data)
data |
A data frame |
This is a wrapper function that calls wqb_af_bc_species()
,
wqb_af_ecological()
and wqb_af_variation()
.
A data frame
## Not run: data <- wqb_af(data) ## End(Not run)
## Not run: data <- wqb_af(data) ## End(Not run)
Determines an assessment factor based on the number of BC species present.
wqb_af_bc_species(data)
wqb_af_bc_species(data)
data |
A data frame |
Check the resource document for how the assessment factor was calculated.
A data frame
## Not run: data <- wqb_af_bc_species(data) ## End(Not run)
## Not run: data <- wqb_af_bc_species(data) ## End(Not run)
Determines the assessment factor based on the presence of certain ecological groups.
wqb_af_ecological(data)
wqb_af_ecological(data)
data |
A data frame |
Check the resource document for how the assessment factor was calculated.
A data frame
## Not run: data <- wqb_af_ecological(data) ## End(Not run)
## Not run: data <- wqb_af_ecological(data) ## End(Not run)
Determine the assessment factor based on the number of trophic groups and species.
wqb_af_variation(data)
wqb_af_variation(data)
data |
A data frame |
Check the resource document for how the assessment factor was calculated.
A data frame
## Not run: data <- wqb_af_variation(data) ## End(Not run)
## Not run: data <- wqb_af_variation(data) ## End(Not run)
Aggregate data to select the most sensitive value for each species. The priority of effect level depends on the benchmark method that will be used.
wqb_aggregate(data)
wqb_aggregate(data)
data |
A data frame |
Check the resource document for the rules used to aggregate the data down to a single value per species. This is Step 5.
A data frame
## Not run: data <- wqb_aggregate(data) ## End(Not run)
## Not run: data <- wqb_aggregate(data) ## End(Not run)
Determine if a species sensitivity distribution (SSD) or deterministic method
will be used to determine the aquatic life water quality benchmark value
for the data. A column called method
will be added to the data indicating
which method will be used.
wqb_benchmark_method(data)
wqb_benchmark_method(data)
data |
A data frame |
Check the resource document for the rules used to determine which benchmark method will be used. This is Step 4.
A data frame
## Not run: data <- wqb_benchmark_method(data) data <- wqb_benchmark_method(aggregated_data) ## End(Not run)
## Not run: data <- wqb_benchmark_method(data) data <- wqb_benchmark_method(aggregated_data) ## End(Not run)
Checks the uploaded data for the basic requirements to ensure the data matches the downloaded Ecotox data.
wqb_check_add_data(data, template)
wqb_check_add_data(data, template)
data |
A data frame. The data you want to check. |
template |
A data frame. The format the data should be in, in the chktemplate format. |
The values for the endpoint, trophic_group, and ecological_group columns are checked against the data tables used to build the database. To update the allowed values the corresponding csv file needs to be updated.
A data frame
## Not run: data <- wqb_check_add_data(data, template) ## End(Not run)
## Not run: data <- wqb_check_add_data(data, template) ## End(Not run)
Classify each test as either acute or chronic in the duration_class
column.
wqb_classify_duration(data, quiet = FALSE)
wqb_classify_duration(data, quiet = FALSE)
data |
A data frame |
quiet |
Turn off message when quiet set to TRUE. |
Check the resource document for the rules used to determine the classification for each trophic group. This is Step 2.
A data frame
## Not run: classified_data <- wqb_classify_duration(compiled_data) ## End(Not run)
## Not run: classified_data <- wqb_classify_duration(compiled_data) ## End(Not run)
Join database tables together and start filtering and cleaning data.
wqb_clean_data(data, quiet = FALSE)
wqb_clean_data(data, quiet = FALSE)
data |
A data frame. |
quiet |
Turn off message when quiet set to TRUE. |
Check the resource document more details on the data added, filter conditions and cleaning steps. This is part of Step 1.
Invisible data frame
## Not run: data <- wqb_clean_data(data) ## End(Not run)
## Not run: data <- wqb_clean_data(data) ## End(Not run)
This function downloads the data, creates and adds all the data to the database, compiles, standardizes, and classifies the data. The output of this function is fed into the app.
wqb_create_data_set( file_path = "~/Ecotoxicology/ecotox", version = 1, folder_path = "~/Ecotoxicology/ecotox_db/", quiet = FALSE, ask = TRUE, save_rds = TRUE )
wqb_create_data_set( file_path = "~/Ecotoxicology/ecotox", version = 1, folder_path = "~/Ecotoxicology/ecotox_db/", quiet = FALSE, ask = TRUE, save_rds = TRUE )
file_path |
A string of the file path location to save the downloaded files. The default is your current working directory. |
version |
An integer to indicate which version you want to download. The default is 1 which downloads the most recent version. |
folder_path |
Folder path to write to. |
quiet |
Turn off message when quiet set to TRUE. |
ask |
Turn off question when set to FALSE. |
save_rds |
Saves the data set as a rds file in the folder_path. Turn off when set to FALSE. |
A data frame
## Not run: wqb_create_data_set( file_path = "~/Ecotoxicology/ecotox", version = 1, folder_path = "~/Ecotoxicology/ecotox_db/" ) ## End(Not run)
## Not run: wqb_create_data_set( file_path = "~/Ecotoxicology/ecotox", version = 1, folder_path = "~/Ecotoxicology/ecotox_db/" ) ## End(Not run)
Create a SQLite database from the US EPA ECOTOX downloaded files.
wqb_create_epa_ecotox(folder_path = ".", data_path, quiet = FALSE, ask = TRUE)
wqb_create_epa_ecotox(folder_path = ".", data_path, quiet = FALSE, ask = TRUE)
folder_path |
Folder path to write to. |
data_path |
Folder path to the downloaded ECOTOX folder |
quiet |
Turn off message when quiet set to TRUE. |
ask |
Turn off question when set to FALSE. |
This functions reads in the text files in the folder and writes them to the database.
This function will overwrite a database if already present.
Invisible string of the file path of the database.
## Not run: wqb_create_epa_ecotox(data_path = "ecotox_ascii_12_15_2022") ## End(Not run)
## Not run: wqb_create_epa_ecotox(data_path = "ecotox_ascii_12_15_2022") ## End(Not run)
Download the ECOTOX data files from their FTP website. The default is to download the most recent version of the data.
wqb_download_epa_ecotox( file_path = ".", version = 1, ask = TRUE, quiet = FALSE )
wqb_download_epa_ecotox( file_path = ".", version = 1, ask = TRUE, quiet = FALSE )
file_path |
A string of the file path location to save the downloaded files. The default is your current working directory. |
version |
An integer to indicate which version you want to download. The default is 1 which downloads the most recent version. |
ask |
Turn off question when set to FALSE. |
quiet |
Turn off message when quiet set to TRUE. |
You have the option of downloading older version of the data but only up to the four most recent version. The most recent version is set as 1 and the oldest version is version 4.
The downloaded folder will contain various files that are needed to build the database.
You must have a working internet connection to run this function successfully.
Invisible string of the file path the downloaded files were saved.
US EPA ECOTOX website: https://cfpub.epa.gov/ecotox/
Olker, J. H., Elonen, C. M., Pilli, A., Anderson, A., Kinziger, B., Erickson, S., Skopinski, M., Pomplun, A., LaLone, C. A., Russom, C. L., & Hoff, D. (2022). The ECOTOXicology Knowledgebase: A Curated Database of Ecologically Relevant Toxicity Tests to Support Environmental Research and Risk Assessment. Environmental Toxicology and Chemistry, 41(6):1520-1539. https://doi.org/10.1002/etc.5324
## Not run: wqb_download_epa_ecotox() wqb_download_epa_ecotox("data_download") # pull previous version of the database wqb_download_epa_ecotox("data_download", version = 2) ## End(Not run)
## Not run: wqb_download_epa_ecotox() wqb_download_epa_ecotox("data_download") # pull previous version of the database wqb_download_epa_ecotox("data_download", version = 2) ## End(Not run)
Filter to a Single Chemical
wqb_filter_chemical(data, cas_num)
wqb_filter_chemical(data, cas_num)
data |
A data frame |
cas_num |
A string of the cas number. |
A data frame
## Not run: data <- wqb_filter_chemical(data, "129909906") data <- wqb_filter_chemical(data, "1000984359") ## End(Not run)
## Not run: data <- wqb_filter_chemical(data, "129909906") data <- wqb_filter_chemical(data, "1000984359") ## End(Not run)
Determine the critical toxicity value for the species. The function will apply the method listed in the method column.
wqb_generate_ctv(data, dists = ssdtools::ssd_dists_bcanz())
wqb_generate_ctv(data, dists = ssdtools::ssd_dists_bcanz())
data |
A data frame |
dists |
A character vector of the distributions to fit. |
The ctv_est_mg.L is the estimate of the critical toxicity value for the species. The ctv_lcl_mg.L is the lower confidence limit. The ctv_ucl_mg.L is the upper confidence limit.
The Deterministic method will always produce missing values in the ctv_lcl_mg.L and ctv_ucl_mg.L columns.
A data frame
## Not run: ctv <- wqb_generate_ctv(data) ## End(Not run)
## Not run: ctv <- wqb_generate_ctv(data) ## End(Not run)
Join database tables together and start filtering and cleaning data.
wqb_join_data(database, quiet = FALSE)
wqb_join_data(database, quiet = FALSE)
database |
A string to the location of the database. |
quiet |
Turn off message when quiet set to TRUE. |
Check the resource document more details on the data added, filter conditions and cleaning steps. This is part of Step 1.
Invisible data frame
## Not run: data_compiled <- wqb_join_data( database = "ecotox_ascii_09_15_2022.sqlite" ) data_compiled <- wqb_join_data( database = "ecotox_db/ecotox_ascii_09_15_2022.sqlite" ) ## End(Not run)
## Not run: data_compiled <- wqb_join_data( database = "ecotox_ascii_09_15_2022.sqlite" ) data_compiled <- wqb_join_data( database = "ecotox_db/ecotox_ascii_09_15_2022.sqlite" ) ## End(Not run)
Use the deterministic method to generate the critical toxicity value for the data set.
wqb_method_det(data)
wqb_method_det(data)
data |
A data frame |
Check the resource document for more details . This is Step 1.
A data frame
## Not run: bench_iodine <- wqb_method_det(data) ## End(Not run)
## Not run: bench_iodine <- wqb_method_det(data) ## End(Not run)
Use a species sensitivity distribution to calculate the critical toxicity value for the data set. The critical toxicity value is the hazardous concentration for 5% of species (HC5) when the SSD method is used.
wqb_method_ssd(data, fit, nboot = 1000)
wqb_method_ssd(data, fit, nboot = 1000)
data |
A data frame |
fit |
The fit |
nboot |
The number of bootstrap samples. Default value of 1000. |
A wrapper on the ssdtools package function
ssdtools::ssd_hc_bcanz()
that only returns the HC5 concentration.
A data frame
## Not run: hc5 <- wqb_method_ssd(data, fit) ## End(Not run)
## Not run: hc5 <- wqb_method_ssd(data, fit) ## End(Not run)
Plot the standardized data to see the concentrations per species for each endpoint.
wqb_plot(data)
wqb_plot(data)
data |
A data frame |
## Not run: wqb_plot(data) ## End(Not run)
## Not run: wqb_plot(data) ## End(Not run)
Plot deterministic results to see the standardized data, critical toxicity value and aquatic life benchmark.
wqb_plot_det(data)
wqb_plot_det(data)
data |
A data frame |
## Not run: wqb_plot_det(data) ## End(Not run)
## Not run: wqb_plot_det(data) ## End(Not run)
Plot results to see the species sensitivity distribution. The dashed line shows the HC5 value.
wqb_plot_ssd(data, fit)
wqb_plot_ssd(data, fit)
data |
A data frame |
fit |
The fit from ssd |
This is a wrapper on ssdtools::predict()
and
ssdtools::ssd_plot()
.
## Not run: wqb_plot_ssd(data, fit) ## End(Not run)
## Not run: wqb_plot_ssd(data, fit) ## End(Not run)
Wrapper to ssdtools::ssd_fit_bcanz()
. The sp_aggre_conc_mg.L values are
the concentrations used.
wqb_ssd_fit(data, dists = ssdtools::ssd_dists_bcanz())
wqb_ssd_fit(data, dists = ssdtools::ssd_dists_bcanz())
data |
A data frame |
dists |
A character vector of the distributions to fit |
A data frame
## Not run: fit <- wqb_ssd_fit(data) ## End(Not run)
## Not run: fit <- wqb_ssd_fit(data) ## End(Not run)
Wrapper to the ssdtools::ssd_hc_bcanz()
function and selects only the row
which is 5%.
wqb_ssd_hc5(fit, nboot = 1000)
wqb_ssd_hc5(fit, nboot = 1000)
fit |
The fit from ssd |
nboot |
A count of the number of bootstrap samples to use to estimate the SE and confidence limits. Default value of 1000. |
The number of bootstrap samples is set to 1000 so the estimates are
quick to generate. Check out ssdtools::ssd_hc_bcanz()
for more details.
A data frame
## Not run: hc5 <- wqb_ssd_hc5(fit) ## End(Not run)
## Not run: hc5 <- wqb_ssd_hc5(fit) ## End(Not run)
Determine and apply factor needed to standardize the endpoints.
wqb_standardize_effect(data, quiet = FALSE)
wqb_standardize_effect(data, quiet = FALSE)
data |
A data frame |
quiet |
Turn off message when quiet set to TRUE. |
Check the resource document for details the rules used to determine standardized the endpoints. This is Step 3.
A data frame
## Not run: standardized_effect_data <- wqb_standardize_effect(data) standardized_effect_data <- wqb_standardize_effect(classified_data) ## End(Not run)
## Not run: standardized_effect_data <- wqb_standardize_effect(data) standardized_effect_data <- wqb_standardize_effect(classified_data) ## End(Not run)
Create summary table of the species variation factor, ecological assessment factor and B.C. species factor.
wqb_summary_af(data)
wqb_summary_af(data)
data |
A data frame |
A data frame
## Not run: summary_af <- wqb_summary_af(data) ## End(Not run)
## Not run: summary_af <- wqb_summary_af(data) ## End(Not run)
Summary Table of Assessment Factors Information
wqb_summary_trophic_groups(data)
wqb_summary_trophic_groups(data)
data |
A data frame |
A data frame
## Not run: summary_af <- wqb_summary_trophic_groups(data) ## End(Not run)
## Not run: summary_af <- wqb_summary_trophic_groups(data) ## End(Not run)
Summary Table of Number of Species per Trophic Group
wqb_summary_trophic_species(data)
wqb_summary_trophic_species(data)
data |
A data frame |
A data frame.
## Not run: summary_trophic <- wqb_summary_trophic_species(data) ## End(Not run)
## Not run: summary_trophic <- wqb_summary_trophic_species(data) ## End(Not run)