| Title: | Calculate Pesticide Risk Metric (PRM) Values from Multiple Pesticides...Calc Them All |
|---|---|
| Description: | Contains functions which can be used to calculate Pesticide Risk Metric values in aquatic environments from concentrations of multiple pesticides with known species sensitive distributions (SSDs). Pesticides provided by this package have all be validated however if the user has their own pesticides with SSD values they can append them to the pesticide_info table to include them in estimates. |
| Authors: | Alexander Bezzina [aut, cre, cph], Jennifer Strauss [aut], Catherine Neelamraju [aut], Hayley Kaminski [aut] |
| Maintainer: | Alexander Bezzina <[email protected]> |
| License: | GPL (>= 3) |
| Version: | 1.1.1.9000 |
| Built: | 2026-05-15 09:16:51 UTC |
| Source: | https://github.com/alexwaterboybezzina/calcthemall.prm |
Add new pesticides to the pesticide_info table
add_your_own_pesticide( pesticides, relative_LORs, pesticide_types, distribution_types, shape_locations = NA, shape_location_2s = NA, scales = NA, scale_2s = NA, weights = NA, pesticide_info = CalcThemAll.PRM::pesticide_info )add_your_own_pesticide( pesticides, relative_LORs, pesticide_types, distribution_types, shape_locations = NA, shape_location_2s = NA, scales = NA, scale_2s = NA, weights = NA, pesticide_info = CalcThemAll.PRM::pesticide_info )
pesticides |
A vector of pesticide names |
relative_LORs |
A vector of relative limit of reporting replacement values |
pesticide_types |
A vector of the new pesticide's types |
distribution_types |
A vector of the new pesticide's species sensitivity distribution types |
shape_locations |
A vector of shape/location values (if applicable, else put NA) |
shape_location_2s |
A vector of secondary shape/location values (if applicable, else put NA) |
scales |
A vector of scale values (if applicable, else put NA) |
scale_2s |
A vector of secondary scale values (if applicable, else put NA) |
weights |
A vector of weight values (if applicable, else put NA) |
pesticide_info |
A data set to add pesticides too |
A data frame
new <- add_your_own_pesticide(pesticides = "Poison", relative_LORs = 0.023, pesticide_types = "Poison", distribution_types = "Log-Normal", scales = 0.09, shape_locations = 0.014) multiple_new <- add_your_own_pesticide(pesticides = c("Poison", "Acid", "Sludge"), relative_LORs = c(0.03, 0.01, 0.5), pesticide_types = c("Poison", "Acid", "Sludge"), distribution_types = c("Log-Normal", "Log-Logistic Log-Logistic", "Burr Type III"), scales = c(0.3, 0.002, 2), scale_2s = c(NA, 0.04, NA), shape_locations = c(1, 0.07, 3), shape_location_2s = c(NA, 0.14, 2.3), weights = c(NA, 0.08, NA))new <- add_your_own_pesticide(pesticides = "Poison", relative_LORs = 0.023, pesticide_types = "Poison", distribution_types = "Log-Normal", scales = 0.09, shape_locations = 0.014) multiple_new <- add_your_own_pesticide(pesticides = c("Poison", "Acid", "Sludge"), relative_LORs = c(0.03, 0.01, 0.5), pesticide_types = c("Poison", "Acid", "Sludge"), distribution_types = c("Log-Normal", "Log-Logistic Log-Logistic", "Burr Type III"), scales = c(0.3, 0.002, 2), scale_2s = c(NA, 0.04, NA), shape_locations = c(1, 0.07, 3), shape_location_2s = c(NA, 0.14, 2.3), weights = c(NA, 0.08, NA))
Burr Type III (Inverse Burr) Equation Formula
Burr_Type_III_Formula(concentration, scale, shape_location, shape_location_2)Burr_Type_III_Formula(concentration, scale, shape_location, shape_location_2)
concentration |
The vector of concentration values for a selected pesticide, that has a Burr Type III shaped species sensitivity distribution, to run the equation on. |
scale |
The Burr Type III scale/b value for the selected pesticide. These can be found in the "pesticide_info" data frame provided in this package. If you are including other pesticides you will need to append them with their respective distribution variables to the "pesticide_info" data frame. |
shape_location |
The Burr Type III c/shape value for the selected pesticide. These can be found in the "pesticide_info" data frame provided in this package. If you are including other pesticides you will need to append them with their respective distribution variables to the "pesticide_info" table. |
shape_location_2 |
The Burr Type III k/shape value for the selected pesticide. These can be found in the "pesticide_info" data frame provided in this package. If you are including other pesticides you will need to append them with their respective distribution variables to the "pesticide_info" table. |
a numeric vector
#Chlorpyrifos is used as its species sensitivity distribution fits Burr Type III Chlorpyrifos <- c(0.000000001, 0.5, 2.7, 11) Burr_Type_III_Formula(concentration = Chlorpyrifos, scale = pesticide_info$scale[pesticide_info$pesticide == "Chlorpyrifos"], shape_location = pesticide_info$shape_location[pesticide_info$pesticide == "Chlorpyrifos"], shape_location_2 = pesticide_info$shape_location_2[pesticide_info$pesticide == "Chlorpyrifos"])#Chlorpyrifos is used as its species sensitivity distribution fits Burr Type III Chlorpyrifos <- c(0.000000001, 0.5, 2.7, 11) Burr_Type_III_Formula(concentration = Chlorpyrifos, scale = pesticide_info$scale[pesticide_info$pesticide == "Chlorpyrifos"], shape_location = pesticide_info$shape_location[pesticide_info$pesticide == "Chlorpyrifos"], shape_location_2 = pesticide_info$shape_location_2[pesticide_info$pesticide == "Chlorpyrifos"])
Calculate Daily Average Pesticide Risk Metric Values For Each Pesticide Type
calculate_daily_average_PRM( LOR_treated_data, include_PAF = FALSE, pesticide_info = CalcThemAll.PRM::pesticide_info )calculate_daily_average_PRM( LOR_treated_data, include_PAF = FALSE, pesticide_info = CalcThemAll.PRM::pesticide_info )
LOR_treated_data |
A data set of LOR treated pesticide concentration values in individual columns that match the pesticide names in the "pesticide_info" data frame. This data set should also include a "Date", "Sampling Year" and "Site Name" column. |
include_PAF |
If "TRUE" Percentage Affected Fraction values are included in the output along with Daily PRM in a list format. These values can be useful for plotting relative individual pesticide contribution to overall PRM, however most will not need this so default is "FALSE". |
pesticide_info |
The reference table which contains all relevant information for calculations. It is recommended that the "pesticide_info" data set included in this package be used and if you wish to include more pesticides you can appended them with the relevant information to this table. If you are creating your own table you must ensure that the pesticide name column is title "pesticide" and the relative LOR replacement column is "relative_LOR" for the function to run. |
If include_PAF is "FALSE" returns a data frame of daily average PRM values for each pesticide type for each sample. Wet season average calculations can be run on the returned data. If include_PAF is "TRUE" returns a list with daily PRM values in a data frame as the first object and a data frame of PAF values as the second object.
Canto_pesticides_LOR_treated <- treat_LORs_all_data(raw_data = Canto_pesticides, pesticide_info = CalcThemAll.PRM::pesticide_info) Canto_daily_PRM <- calculate_daily_average_PRM(LOR_treated_data = Canto_pesticides_LOR_treated) head(Canto_daily_PRM)Canto_pesticides_LOR_treated <- treat_LORs_all_data(raw_data = Canto_pesticides, pesticide_info = CalcThemAll.PRM::pesticide_info) Canto_daily_PRM <- calculate_daily_average_PRM(LOR_treated_data = Canto_pesticides_LOR_treated) head(Canto_daily_PRM)
Calculate Wet Season Average Pesticide Risk Metric Values Using Multiple Imputation
calculate_wet_season_average_PRM( daily_PRM_data, PRM_group = "Total PRM", imputations = 1000, min_sampling_days = 12, wet_season_length = 182 )calculate_wet_season_average_PRM( daily_PRM_data, PRM_group = "Total PRM", imputations = 1000, min_sampling_days = 12, wet_season_length = 182 )
daily_PRM_data |
A data set of calculated daily average PRM values. This data set should also include a "Date", "Sampling Year" and "Site Name" column. |
PRM_group |
This specifies the name of the column to run the calculations on. The daily average calculations gives PRM for each pesticide type and total in different columns so this selects which to run. "Total" is set as the default as it is the PRM of all pesticides. |
imputations |
This sets the number of imputations to run. The more imputations the greater the reliability, however it also increases calculation time. You can increase imputations beyond 1000 however the improvement of the confidence interval on imputed values may not be sufficient to warrant increased computing time. We recommend 1000 :) |
min_sampling_days |
This is the minimum number of sampling days a site-year combination must have to calculate a wet season average PRM. No less than 12 is the default (1 for each month) for reliability but more is recommended. |
wet_season_length |
The length of the wet season in days. |
A data frame
Canto_pesticides_LOR_treated <- treat_LORs_all_data(raw_data = Canto_pesticides, pesticide_info = CalcThemAll.PRM::pesticide_info) Canto_daily_PRM <- calculate_daily_average_PRM(LOR_treated_data = Canto_pesticides_LOR_treated) Celestial_City_2019_2020_daily_PRM <- Canto_daily_PRM %>% dplyr::filter(`Site Name` == "Celestial City" & `Sampling Year` == "2019-2020") CC2019_2020_wet_season_PSII_PRM <- calculate_wet_season_average_PRM(daily_PRM_data = Celestial_City_2019_2020_daily_PRM, PRM_group = "PSII Herbicide PRM") CC2019_2020_wet_season_PSII_PRMCanto_pesticides_LOR_treated <- treat_LORs_all_data(raw_data = Canto_pesticides, pesticide_info = CalcThemAll.PRM::pesticide_info) Canto_daily_PRM <- calculate_daily_average_PRM(LOR_treated_data = Canto_pesticides_LOR_treated) Celestial_City_2019_2020_daily_PRM <- Canto_daily_PRM %>% dplyr::filter(`Site Name` == "Celestial City" & `Sampling Year` == "2019-2020") CC2019_2020_wet_season_PSII_PRM <- calculate_wet_season_average_PRM(daily_PRM_data = Celestial_City_2019_2020_daily_PRM, PRM_group = "PSII Herbicide PRM") CC2019_2020_wet_season_PSII_PRM
A subset of pesticide concentration data for all pesticides in "pesticide_info" created for this package with fabricated sites
Canto_pesticidesCanto_pesticides
Canto_pesticidesA data frame with 808 rows and 64 columns:
Site name
Sampling date
pesticide concentration values in ug/L
...
Find Sampling Year
find_Sampling_Year(dates, wet_season_split = 7)find_Sampling_Year(dates, wet_season_split = 7)
dates |
A date vector of sampling dates. Must be in yyyy-mm-dd format. |
wet_season_split |
The first month of the sampling year in numeric e.g. July = 7. July (7) is used as the default as this is the first month of the Queensland wet season. |
A factored character vector
dates <- as.Date(c("2014-03-04", "2014-12-30", "2015-06-12")) sampling_years <- find_Sampling_Year(dates) #cut of datedates <- as.Date(c("2014-03-04", "2014-12-30", "2015-06-12")) sampling_years <- find_Sampling_Year(dates) #cut of date
Find Sample's Season (Wet or Dry)
find_season(wet_season_start_dates, sampling_dates, wet_season_length = 182)find_season(wet_season_start_dates, sampling_dates, wet_season_length = 182)
wet_season_start_dates |
A vector of dates signifying the first day of the wet season for site year combinations. |
sampling_dates |
A date vector of sampling dates. Must be in yyyy-mm-dd format. |
wet_season_length |
The length of the wet season in days. |
A character vector
dates <- as.Date(c("2014-12-04", "2014-10-30", "2015-11-12")) wet_start_dates <- as.Date(c("2014-10-04", "2014-12-30", "2015-09-12")) Seasons <- find_season(wet_start_dates, sampling_dates = dates) #cut of date for the sampling year will be last day of Junedates <- as.Date(c("2014-12-04", "2014-10-30", "2015-11-12")) wet_start_dates <- as.Date(c("2014-10-04", "2014-12-30", "2015-09-12")) Seasons <- find_season(wet_start_dates, sampling_dates = dates) #cut of date for the sampling year will be last day of June
Find Wet Season End Date
find_wet_season_end(wet_season_start, wet_season_length = 182)find_wet_season_end(wet_season_start, wet_season_length = 182)
wet_season_start |
A vector of dates signifying the first day of the wet season for site year combinations. |
wet_season_length |
The length of the wet season in days. |
A character vector
wet_season_start_dates <- as.Date(c("2014-10-04", "2014-12-30", "2015-09-12")) wet_season_end_dates <- find_wet_season_end(wet_season_start_dates) #cut of date for the sampling year will be last day of Junewet_season_start_dates <- as.Date(c("2014-10-04", "2014-12-30", "2015-09-12")) wet_season_end_dates <- find_wet_season_end(wet_season_start_dates) #cut of date for the sampling year will be last day of June
Gamma CDF Equation Formula
Gamma_Formula(concentration, shape_location, scale)Gamma_Formula(concentration, shape_location, scale)
concentration |
The vector of concentration values for a selected pesticide, that has a Gamma shaped species sensitivity distribution, to run the equation on. |
shape_location |
The k/shape value for the Gamma equation for the selected pesticide. These can be found in the "pesticide_info" data frame provided in this package. If you are including other pesticides you will need to append them with their respective distribution variables to the "pesticide_info" table. |
scale |
The scale/theta value for the Gamma equation for the selected pesticide. These can be found in the "pesticide_info" data frame provided in this package. If you are including other pesticides you will need to append them with their respective distribution variables to the "pesticide_info" table. |
a numeric vector
gamma_pesticide_concentrations <- c(0.000000001, 0.5, 2.7, 11) Gamma_Formula(concentration = gamma_pesticide_concentrations, shape_location = 0.23, scale = 1.3)gamma_pesticide_concentrations <- c(0.000000001, 0.5, 2.7, 11) Gamma_Formula(concentration = gamma_pesticide_concentrations, shape_location = 0.23, scale = 1.3)
Imputation Function - Beta Version
imputation_beta(impute_variable, wet_season_length = 182)imputation_beta(impute_variable, wet_season_length = 182)
impute_variable |
The variable you wish to impute. |
wet_season_length |
The length of the wet season in days. |
A data frame.
Imputation Function - Kernal Version
imputation_kernel(impute_variable, wet_season_length = 182)imputation_kernel(impute_variable, wet_season_length = 182)
impute_variable |
The variable you wish to impute. |
wet_season_length |
The length of the wet season in days. |
A data frame.
Inverse Weibull Formula
Inverse_Weibull_Formula(concentration, shape_location, scale)Inverse_Weibull_Formula(concentration, shape_location, scale)
concentration |
The vector of concentration values for a selected pesticide, that has a Inverse Weibull shaped species sensitivity distribution, to run the equation on. |
shape_location |
The Inverse Weibull shape/alpha value for the selected pesticide. These can be found in the "pesticide_info" data frame provided in this package. If you are including other pesticides you will need to append them with their respective distribution variables to the "pesticide_info" table. |
scale |
The Inverse Weibull scale/beta value for the selected pesticide. These can be found in the "pesticide_info" data frame provided in this package. If you are including other pesticides you will need to append them with their respective distribution variables to the "pesticide_info" table. |
a numeric vector
Hexazinone <- c(0.000000001, 0.5, 2.7, 11) #Hexazinone is used as its species sensitivity distribution plots fits Inverse Weibull Inverse_Weibull_Formula(concentration = Hexazinone, shape_location = pesticide_info$shape_location[pesticide_info$pesticide == "Hexazinone"], scale = pesticide_info$scale[pesticide_info$pesticide == "Hexazinone"])Hexazinone <- c(0.000000001, 0.5, 2.7, 11) #Hexazinone is used as its species sensitivity distribution plots fits Inverse Weibull Inverse_Weibull_Formula(concentration = Hexazinone, shape_location = pesticide_info$shape_location[pesticide_info$pesticide == "Hexazinone"], scale = pesticide_info$scale[pesticide_info$pesticide == "Hexazinone"])
Log Gumbel CDF Equation Formula
Log_Gumbel_Formula(concentration, shape_location, scale)Log_Gumbel_Formula(concentration, shape_location, scale)
concentration |
The vector of concentration values for a selected pesticide, that has a Log Gumbel shaped species sensitivity distribution, to run the equation on. |
shape_location |
The mu/location value for the Log Gumbel equation for the selected pesticide. These can be found in the "pesticide_info" data frame provided in this package. If you are including other pesticides you will need to append them with their respective distribution variables to the "pesticide_info" table. |
scale |
The beta/scale value for the Log Gumbel equation for the selected pesticide. These can be found in the "pesticide_info" data frame provided in this package. If you are including other pesticides you will need to append them with their respective distribution variables to the "pesticide_info" table. |
a numeric vector
#This Example should produce roughly 1% and 5% PRM values LogGumbel_pesticide_concentrations <- c(0.095957794, 0.245881898) Log_Gumbel_Formula(concentration = LogGumbel_pesticide_concentrations, shape_location = 0.9980581, scale = 2.188285)#This Example should produce roughly 1% and 5% PRM values LogGumbel_pesticide_concentrations <- c(0.095957794, 0.245881898) Log_Gumbel_Formula(concentration = LogGumbel_pesticide_concentrations, shape_location = 0.9980581, scale = 2.188285)
Log Logistic Formula
Log_Logistic_Formula(concentration, scale, shape_location)Log_Logistic_Formula(concentration, scale, shape_location)
concentration |
The vector of concentration values for a selected pesticide, that has a Log Logistic shaped species sensitivity distribution, to run the equation on. |
scale |
The Log Logistic alpha/scale value for the selected pesticide. These can be found in the "pesticide_info" data frame provided in this package. If you are including other pesticides you will need to append them with their respective distribution variables to the "pesticide_info" table. |
shape_location |
The Log Logistic beta/shape value for the selected pesticide. These can be found in the "pesticide_info" data frame provided in this package. If you are including other pesticides you will need to append them with their respective distribution variables to the "pesticide_info" table. |
a numeric vector
Imazapic <- c(0.000000001, 0.5, 2.7, 11) #Imazapic is used as its species sensitivity distribution plots fits Log Logistic Log_Logistic_Formula(concentration = Imazapic, scale = pesticide_info$scale[pesticide_info$pesticide == "Imazapic"], shape_location = pesticide_info$shape_location[pesticide_info$pesticide == "Imazapic"])Imazapic <- c(0.000000001, 0.5, 2.7, 11) #Imazapic is used as its species sensitivity distribution plots fits Log Logistic Log_Logistic_Formula(concentration = Imazapic, scale = pesticide_info$scale[pesticide_info$pesticide == "Imazapic"], shape_location = pesticide_info$shape_location[pesticide_info$pesticide == "Imazapic"])
Log Logistic Log Logistic (double curve) CDF Formula
Log_Logistic_Log_Logistic_Formula( concentration, scale, shape_location, scale_2, shape_location_2, weight )Log_Logistic_Log_Logistic_Formula( concentration, scale, shape_location, scale_2, shape_location_2, weight )
concentration |
The vector of concentration values for a selected pesticide, that has a Log Logistic Log Logistic shaped species sensitivity distribution, to run the equation on. |
scale |
The alpha/scale value for the first Log Logistic equation for the selected pesticide. These can be found in the "pesticide_info" data frame provided in this package. If you are including other pesticides you will need to append them with their respective distribution variables to the "pesticide_info" table. |
shape_location |
The beta/shape value for the first Log Logistic equation for the selected pesticide. These can be found in the "pesticide_info" data frame provided in this package. If you are including other pesticides you will need to append them with their respective distribution variables to the "pesticide_info" table. |
scale_2 |
The alpha/scale value for the second Log Logistic equation for the selected pesticide. These can be found in the "pesticide_info" data frame provided in this package. If you are including other pesticides you will need to append them with their respective distribution variables to the "pesticide_info" table. |
shape_location_2 |
The beta/shape value for the second Log Logistic equation for the selected pesticide. These can be found in the "pesticide_info" data frame provided in this package. If you are including other pesticides you will need to append them with their respective distribution variables to the "pesticide_info" table. |
weight |
The weight parameter for combining the two equations for the selected pesticide. These can be found in the "pesticide_info" data frame provided in this package. If you are including other pesticides you will need to append them with their respective distribution variables to the "pesticide_info" table. |
a numeric vector
#This Example should produce roughly 1% and 5% PRM values LogL_LogL_pesticide_concentrations <- c(0.00341453, 0.009854566) Log_Logistic_Log_Logistic_Formula(concentration = LogL_LogL_pesticide_concentrations, scale = 0.5823392, shape_location = -3.499604, scale_2 = 1.144555, shape_location_2 = 1.100755, weight = 0.3585467)#This Example should produce roughly 1% and 5% PRM values LogL_LogL_pesticide_concentrations <- c(0.00341453, 0.009854566) Log_Logistic_Log_Logistic_Formula(concentration = LogL_LogL_pesticide_concentrations, scale = 0.5823392, shape_location = -3.499604, scale_2 = 1.144555, shape_location_2 = 1.100755, weight = 0.3585467)
Log-Normal CDF Equation Formula
Log_Normal_Formula(concentration, shape_location, scale)Log_Normal_Formula(concentration, shape_location, scale)
concentration |
The vector of concentration values for a selected pesticide, that has a Log Normal shaped species sensitivity distribution, to run the equation on. |
shape_location |
The mu/location value for the Log Normal equation for the selected pesticide. These can be found in the "pesticide_info" data frame provided in this package. If you are including other pesticides you will need to append them with their respective distribution variables to the "pesticide_info" table. |
scale |
The sigma/scale value for the Log Normal equation for the selected pesticide. These can be found in the "pesticide_info" data frame provided in this package. If you are including other pesticides you will need to append them with their respective distribution variables to the "pesticide_info" table. |
a numeric vector
LogN_pesticide_concentrations <- c(0.000000001, 0.5, 2.7, 11) Log_Normal_Formula(concentration = LogN_pesticide_concentrations, shape_location = 0.23, scale = 1.3)LogN_pesticide_concentrations <- c(0.000000001, 0.5, 2.7, 11) Log_Normal_Formula(concentration = LogN_pesticide_concentrations, shape_location = 0.23, scale = 1.3)
Log-Normal Log-Normal (double curve) CDF Equation Formula
Log_Normal_Log_Normal_Formula( concentration, shape_location, scale, shape_location_2, scale_2, weight )Log_Normal_Log_Normal_Formula( concentration, shape_location, scale, shape_location_2, scale_2, weight )
concentration |
The vector of concentration values for a selected pesticide, that has a Log Normal Log Normal species sensitivity distribution, to run the equation on. |
shape_location |
The mu/shape value for the first Log Normal equation for the selected pesticide. These can be found in the "pesticide_info" data frame provided in this package. If you are including other pesticides you will need to append them with their respective distribution variables to the "pesticide_info" table. |
scale |
The sigma/scale value for the first Log Normal equation for the selected pesticide. These can be found in the "pesticide_info" data frame provided in this package. If you are including other pesticides you will need to append them with their respective distribution variables to the "pesticide_info" table. |
shape_location_2 |
The mu/shape value for the second Log Normal equation for the selected pesticide. These can be found in the "pesticide_info" data frame provided in this package. If you are including other pesticides you will need to append them with their respective distribution variables to the "pesticide_info" table. |
scale_2 |
The sigma/scale value for the second Log Normal equation for the selected pesticide. These can be found in the "pesticide_info" data frame provided in this package. If you are including other pesticides you will need to append them with their respective distribution variables to the "pesticide_info" table. |
weight |
The weight parameter for combining the two equations for the selected pesticide. These can be found in the "pesticide_info" data frame provided in this package. If you are including other pesticides you will need to append them with their respective distribution variables to the "pesticide_info" table. |
a numeric vector
#This Example should produce roughly 1% and 5% PRM values LogN_LogN_pesticide_concentrations <- c(4.79E-05, 0.000225588) Log_Normal_Log_Normal_Formula(concentration = LogN_LogN_pesticide_concentrations, shape_location = -5.596431, scale = 2.061943, shape_location_2 = 0.01174954, scale_2 = 0.9134796, weight = 0.5733126)#This Example should produce roughly 1% and 5% PRM values LogN_LogN_pesticide_concentrations <- c(4.79E-05, 0.000225588) Log_Normal_Log_Normal_Formula(concentration = LogN_LogN_pesticide_concentrations, shape_location = -5.596431, scale = 2.061943, shape_location_2 = 0.01174954, scale_2 = 0.9134796, weight = 0.5733126)
A reference table for PRM calculations in this package that include pesticide information such as type, species sensitivity distribution distributions and relevant equation variables.
pesticide_infopesticide_info
pesticide_infoA data frame with 62 rows and 9 columns:
Pesticide name
The relative Limit of Reporting replacement value
The pesticide method of effect
The species sensitivity distribution shape/type
Species sensitivity distribution variables used in PRM calculations
...
Plot Daily Average PRM Values for a Single Site/Sampling Year
plot_daily_PRM( daily_PRM_data, wet_season_start = NULL, wet_season_length = 182, PRM_group = "Total PRM", title = FALSE, legend = "Numerical" )plot_daily_PRM( daily_PRM_data, wet_season_start = NULL, wet_season_length = 182, PRM_group = "Total PRM", title = FALSE, legend = "Numerical" )
daily_PRM_data |
A data set of calculated daily average PRM values for a single site and sampling year. This data set should also include a "Date", "Sampling Year" and "Site Name" column. |
wet_season_start |
The date of the start of the wet season for this site sampling year. If not applicable leave as NA |
wet_season_length |
The length of the wet season in days. |
PRM_group |
This specifies the name of the column to plot. The daily average calculations gives PRM for each pesticide type and a total in different columns. "Total" is set as the default as it is the PRM value for all pesticides. |
title |
TRUE or FALSE value to include a title. |
legend |
Does the legend show "Numerical" or "Categorical" values for PRM values on the plot. |
A plotly plot
Canto_pesticides_LOR_treated <- treat_LORs_all_data(raw_data = Canto_pesticides, pesticide_info = CalcThemAll.PRM::pesticide_info) Canto_daily_PRM <- calculate_daily_average_PRM(LOR_treated_data = Canto_pesticides_LOR_treated) Violet_Town_2017_2018_PRM <- Canto_daily_PRM %>% dplyr::filter(.data$`Sampling Year` == "2017-2018" & .data$`Site Name` == "Violet Town") plot_daily_PRM(Violet_Town_2017_2018_PRM, "2017-10-02", PRM_group = "Total PRM")Canto_pesticides_LOR_treated <- treat_LORs_all_data(raw_data = Canto_pesticides, pesticide_info = CalcThemAll.PRM::pesticide_info) Canto_daily_PRM <- calculate_daily_average_PRM(LOR_treated_data = Canto_pesticides_LOR_treated) Violet_Town_2017_2018_PRM <- Canto_daily_PRM %>% dplyr::filter(.data$`Sampling Year` == "2017-2018" & .data$`Site Name` == "Violet Town") plot_daily_PRM(Violet_Town_2017_2018_PRM, "2017-10-02", PRM_group = "Total PRM")
Plot Wet Season Window Box on plot_daily_PRM
plot_wet_season_window(wet_season_start = 0, wet_season_length = 182)plot_wet_season_window(wet_season_start = 0, wet_season_length = 182)
wet_season_start |
The date of the start of the wet season for this site sampling year. |
wet_season_length |
The length of the wet season in days. |
A plotly shape
shape <- plot_wet_season_window(wet_season_start = "2017-08-01")shape <- plot_wet_season_window(wet_season_start = "2017-08-01")
PRM Data Table Function
PRM_DT(PRM_data, fill_cols = NULL, colour_cols = NULL)PRM_DT(PRM_data, fill_cols = NULL, colour_cols = NULL)
PRM_data |
a data frame of either daily average or wet season PRM values |
fill_cols |
A vector of column names of pesticide groups to fill colour with corresponding PRM risk category |
colour_cols |
A vector of column names of pesticide groups to colour text with corresponding PRM risk category |
a data table colour coded to PRM risk
Canto_pesticides_LOR_treated <- treat_LORs_all_data(raw_data = Canto_pesticides, pesticide_info = CalcThemAll.PRM::pesticide_info) Canto_daily_PRM <- calculate_daily_average_PRM(LOR_treated_data = Canto_pesticides_LOR_treated) PRM_DT(PRM_data = Canto_daily_PRM, fill_cols = "Total PRM", colour_cols = c("PSII Herbicide PRM", "Other Herbicide PRM", "Insecticide PRM"))Canto_pesticides_LOR_treated <- treat_LORs_all_data(raw_data = Canto_pesticides, pesticide_info = CalcThemAll.PRM::pesticide_info) Canto_daily_PRM <- calculate_daily_average_PRM(LOR_treated_data = Canto_pesticides_LOR_treated) PRM_DT(PRM_data = Canto_daily_PRM, fill_cols = "Total PRM", colour_cols = c("PSII Herbicide PRM", "Other Herbicide PRM", "Insecticide PRM"))
Treat a single observations LORs
treat_LORs( sample_data, pesticide_info = CalcThemAll.PRM::pesticide_info, treatment_method = "Zero" )treat_LORs( sample_data, pesticide_info = CalcThemAll.PRM::pesticide_info, treatment_method = "Zero" )
sample_data |
A single observation containing a concentration value for each pesticide being used in the metric. LOR values should be in "<0.05" format and no values should be empty "". |
pesticide_info |
The reference table which contains all relevant information for calculations. It is recommended that the "pesticide_info" dataset included in this package be used and if you wish to include more or less pesticides you can appended them with the relevant information to this table. If you are creating your own table you must ensure that the pesticide name column is title "pesticides" and the relative LOR replacement column is "relative_LOR" for the function to run. |
treatment_method |
Select how to treat the LOR values with either "WQI" representing the Queensland Department of Environment & Science Water Quality Monitoring & Investigations team's method for replacing LORs or "Zero" which replaces them with a negligible numeric value. Zero is the default here as this function on its own only treats a single observation and therefore the first detection in the WQI method cannot be used. |
returns the provided data set with the first row's LOR values treated.
first_sample <- Canto_pesticides[1,] #this selects only the first row (sample) LOR_treated_first_sample <- treat_LORs(sample_data = first_sample, pesticide_info = CalcThemAll.PRM::pesticide_info, treatment_method = "Zero") print(LOR_treated_first_sample)first_sample <- Canto_pesticides[1,] #this selects only the first row (sample) LOR_treated_first_sample <- treat_LORs(sample_data = first_sample, pesticide_info = CalcThemAll.PRM::pesticide_info, treatment_method = "Zero") print(LOR_treated_first_sample)
Treat a whole data set's LOR values
treat_LORs_all_data( raw_data, pesticide_info = CalcThemAll.PRM::pesticide_info, wet_season_split = 7, treatment_method = "WQI" )treat_LORs_all_data( raw_data, pesticide_info = CalcThemAll.PRM::pesticide_info, wet_season_split = 7, treatment_method = "WQI" )
raw_data |
A data set of raw pesticide concentration values in individual columns that match the pesticide names in the "pesticide_info" data frame. This data set should also include a "Date" column and "Site Name" column. A reference data set can be seen in the "Canto_pesticides" data frame provided in this package, your data should mirror these column headings. |
pesticide_info |
The reference table which contains all relevant information for calculations. It is recommended that the "pesticide_info" data set included in this package be used and if you wish to include more or less pesticides you can appended them with the relevant information to this table. If you are creating your own table you must ensure that the pesticide name column is title "pesticides" and the relative LOR replacement column is "relative_LOR" for the function to run. |
wet_season_split |
The first month of the sampling year in numeric e.g. July = 7. July (7) is used as the default as this is the first month of the Queensland wet season. This is only required for the LOR replacement method and if needed. |
treatment_method |
Select how to treat the LOR values with either the default "WQI" representing the Queensland Department of Environment & Science Water Quality Monitoring & Investigations team's method for replacing LORs or "Zero" which replaces them with a negligible numeric value. |
returns the raw_data frame with the LOR values replaced by their specified treatment values. PRM calculations can now be run on the returned data.
Canto_pesticides_LOR_treated <- treat_LORs_all_data(raw_data = Canto_pesticides, pesticide_info = CalcThemAll.PRM::pesticide_info) head(Canto_pesticides_LOR_treated)Canto_pesticides_LOR_treated <- treat_LORs_all_data(raw_data = Canto_pesticides, pesticide_info = CalcThemAll.PRM::pesticide_info) head(Canto_pesticides_LOR_treated)