Title: Calculate Pesticide Risk Metric (PRM) Values from Multiple Pesticides...Calc Them All
Version: 1.1.1
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.
Encoding: UTF-8
License: GPL (≥ 3)
RoxygenNote: 7.3.1
Imports: dplyr, lubridate, magrittr, MASS, stats, VGAM, plotly, zoo, DT
Suggests: knitr, rmarkdown, testthat (≥ 3.0.0)
Config/testthat/edition: 3
Depends: R (≥ 2.10)
LazyData: true
VignetteBuilder: knitr
NeedsCompilation: no
Packaged: 2024-04-23 13:44:40 UTC; Alexander
Author: Alexander Bezzina [aut, cre, cph], Jennifer Strauss [aut], Catherine Neelamraju [aut], Hayley Kaminski [aut]
Maintainer: Alexander Bezzina <alex.h.bezzina@gmail.com>
Repository: CRAN
Date/Publication: 2024-04-24 14:30:05 UTC

Pipe operator

Description

See magrittr::%>% for details.

Usage

lhs %>% rhs

Arguments

lhs

A value or the magrittr placeholder.

rhs

A function call using the magrittr semantics.

Value

The result of calling rhs(lhs).


Burr Type III (Inverse Burr) Equation Formula

Description

Burr Type III (Inverse Burr) Equation Formula

Usage

Burr_Type_III_Formula(concentration, scale, shape_location, shape_location_2)

Arguments

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.

Value

a numeric vector

Examples

#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"])

Canto Region Pesticide Concentration Values (Example Data Set)

Description

A subset of pesticide concentration data for all pesticides in "pesticide_info" created for this package with fabricated sites

Usage

Canto_pesticides

Format

Canto_pesticides

A data frame with 808 rows and 64 columns:

Site Name

Site name

Date

Sampling date

Ametryn, Atrazine, Chlorpyrifos, Diuron, Fipronil, Fluroxypyr, Haloxyfop (acid), Hexazinone, Imazapic, Imidacloprid, Isoxaflutole metabolite (DKN), MCPA, Metolachlor, Metribuzin, Metsulfuron methyl, Pendimethalin, Prometryn, Simazine, Tebuthiuron, Terbuthylazine, Triclopyr, 2,4-D, Bromacil Diazinon, Imidicloprid1:40

pesticide concentration values in ug/L

...


Gamma CDF Equation Formula

Description

Gamma CDF Equation Formula

Usage

Gamma_Formula(concentration, shape_location, scale)

Arguments

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.

Value

a numeric vector

Examples

gamma_pesticide_concentrations <- c(0.000000001, 0.5, 2.7, 11)
Gamma_Formula(concentration = gamma_pesticide_concentrations,
shape_location = 0.23, scale = 1.3)

Inverse Weibull Formula

Description

Inverse Weibull Formula

Usage

Inverse_Weibull_Formula(concentration, shape_location, scale)

Arguments

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.

Value

a numeric vector

Examples

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

Description

Log Gumbel CDF Equation Formula

Usage

Log_Gumbel_Formula(concentration, shape_location, scale)

Arguments

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.

Value

a numeric vector

Examples

#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

Description

Log Logistic Formula

Usage

Log_Logistic_Formula(concentration, scale, shape_location)

Arguments

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.

Value

a numeric vector

Examples

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

Description

Log Logistic Log Logistic (double curve) CDF Formula

Usage

Log_Logistic_Log_Logistic_Formula(
  concentration,
  scale,
  shape_location,
  scale_2,
  shape_location_2,
  weight
)

Arguments

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.

Value

a numeric vector

Examples

#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

Description

Log-Normal CDF Equation Formula

Usage

Log_Normal_Formula(concentration, shape_location, scale)

Arguments

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.

Value

a numeric vector

Examples

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

Description

Log-Normal Log-Normal (double curve) CDF Equation Formula

Usage

Log_Normal_Log_Normal_Formula(
  concentration,
  shape_location,
  scale,
  shape_location_2,
  scale_2,
  weight
)

Arguments

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.

Value

a numeric vector

Examples

#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)

PRM Data Table Function

Description

PRM Data Table Function

Usage

PRM_DT(PRM_data, fill_cols = NULL, colour_cols = NULL)

Arguments

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

Value

a data table colour coded to PRM risk

Examples

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"))


Add new pesticides to the pesticide_info table

Description

Add new pesticides to the pesticide_info table

Usage

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
)

Arguments

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

Value

A data frame

Examples

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))

Calculate Daily Average Pesticide Risk Metric Values For Each Pesticide Type

Description

Calculate Daily Average Pesticide Risk Metric Values For Each Pesticide Type

Usage

calculate_daily_average_PRM(
  LOR_treated_data,
  include_PAF = FALSE,
  pesticide_info = CalcThemAll.PRM::pesticide_info
)

Arguments

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.

Value

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.

Examples

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

Description

Calculate Wet Season Average Pesticide Risk Metric Values Using Multiple Imputation

Usage

calculate_wet_season_average_PRM(
  daily_PRM_data,
  PRM_group = "Total PRM",
  imputations = 1000,
  min_sampling_days = 12,
  wet_season_length = 182
)

Arguments

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.

Value

A data frame

Examples

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_PRM


Find Sampling Year

Description

Find Sampling Year

Usage

find_Sampling_Year(dates, wet_season_split = 7)

Arguments

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.

Value

A factored character vector

Examples

dates <- 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)

Description

Find Sample's Season (Wet or Dry)

Usage

find_season(wet_season_start_dates, sampling_dates, wet_season_length = 182)

Arguments

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.

Value

A character vector

Examples

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 June

Find Wet Season End Date

Description

Find Wet Season End Date

Usage

find_wet_season_end(wet_season_start, wet_season_length = 182)

Arguments

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.

Value

A character vector

Examples

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 June

Imputation Function - Beta Version

Description

Imputation Function - Beta Version

Usage

imputation_beta(impute_variable, wet_season_length = 182)

Arguments

impute_variable

The variable you wish to impute.

wet_season_length

The length of the wet season in days.

Value

A data frame.


Imputation Function - Kernal Version

Description

Imputation Function - Kernal Version

Usage

imputation_kernel(impute_variable, wet_season_length = 182)

Arguments

impute_variable

The variable you wish to impute.

wet_season_length

The length of the wet season in days.

Value

A data frame.


Pesticide Information for Pesticide Risk Metric Calculations (Reference Table)

Description

A reference table for PRM calculations in this package that include pesticide information such as type, species sensitivity distribution distributions and relevant equation variables.

Usage

pesticide_info

Format

pesticide_info

A data frame with 62 rows and 9 columns:

pesticide

Pesticide name

relative_LOR

The relative Limit of Reporting replacement value

pesticide_type

The pesticide method of effect

distribution_type

The species sensitivity distribution shape/type

shape_location, shape_location2, scale, scale2, weight

Species sensitivity distribution variables used in PRM calculations

...

Source

https://www.publications.qld.gov.au/dataset/method-development-pesticide-risk-metric-baseline-condition-of-waterways-to-gbr/resource/c65858f9-d7ba-4aef-aa4f-e148f950220f


Plot Daily Average PRM Values for a Single Site/Sampling Year

Description

Plot Daily Average PRM Values for a Single Site/Sampling Year

Usage

plot_daily_PRM(
  daily_PRM_data,
  wet_season_start = NULL,
  wet_season_length = 182,
  PRM_group = "Total PRM",
  title = FALSE,
  legend = "Numerical"
)

Arguments

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.

Value

A plotly plot

Examples

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

Description

Plot Wet Season Window Box on plot_daily_PRM

Usage

plot_wet_season_window(wet_season_start = 0, wet_season_length = 182)

Arguments

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.

Value

A plotly shape

Examples

shape <- plot_wet_season_window(wet_season_start = "2017-08-01")

Treat a single observations LORs

Description

Treat a single observations LORs

Usage

treat_LORs(
  sample_data,
  pesticide_info = CalcThemAll.PRM::pesticide_info,
  treatment_method = "Zero"
)

Arguments

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.

Value

returns the provided data set with the first row's LOR values treated.

Examples

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

Description

Treat a whole data set's LOR values

Usage

treat_LORs_all_data(
  raw_data,
  pesticide_info = CalcThemAll.PRM::pesticide_info,
  wet_season_split = 7,
  treatment_method = "WQI"
)

Arguments

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.

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.

Examples

Canto_pesticides_LOR_treated <- treat_LORs_all_data(raw_data = Canto_pesticides,
pesticide_info = CalcThemAll.PRM::pesticide_info)
head(Canto_pesticides_LOR_treated)

mirror server hosted at Truenetwork, Russian Federation.