calculate_exposure: Calculate exposure to active ingredients present in applied...

Description Usage Arguments Value Note Examples

View source: R/04-calculate.R

Description

For a particular location, buffer radius, date range, and active ingredient or class of active ingredients, calculate_exposure calculates an estimate of exposure in kg of active ingredient per m^2.

Usage

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
calculate_exposure(
  clean_pur_df,
  location,
  radius,
  time_period = NULL,
  start_date = NULL,
  end_date = NULL,
  chemicals = "all",
  aerial_ground = FALSE,
  verbose = TRUE,
  ...
)

Arguments

clean_pur_df

A data frame returned by pull_clean_pur that includes data for the county of your location (before running pull_clean_pur, you can use the find_location_county function to figure this out), the time period, and the active ingredients or chemical classes for which you want to calculate exposure.

location

A length-one character string. Either a California address including street name, city, state, and 5-digit zip code, or a pair of coordinates in the form "longitude, latitude".

radius

A numeric value greater than zero that gives the radius in meters defining the buffer around your location in which you would like to calculate exposure. For reference, the length and width of a PLS section is about 1,609 meters (1 mile). That of a township could range from about 9,656 to 11,265 meters (6-7 miles).

time_period

Optional. A character string giving a time period over which you would like to calculate exposure in days, weeks, months, or years. For example, if you enter "6 months" for time_period, calculate_exposure will calculate exposure for every six month period starting January 1 of the earliest year present in the clean_pur_df data frame. Start and end dates can be optionally specified with the start_date and end_date arguments. Alternatively, to calculate exposure over only one specified time period, you can leave this argument NULL and specify start and end dates.

start_date

Optional. "yyyy-mm-dd" specifying the start date for exposure estimation. This date should be present in the clean_pur_df data frame.

end_date

Optional. "yyyy-mm-dd" specifying the end date for exposure estimation. This date should be present in the clean_pur_df data frame.

chemicals

Either "all" or "chemical_class". The default is "all", which will calculate exposure to the summed active ingredients present in the clean_pur_df data frame. Enter "chemical_class" to calculate exposure to each of the chemical classes present in the chemical_class column of your clean_pur_df data frame.

aerial_ground

TRUE / FALSE for whether you would like to incorporate aerial/ground application into exposure calculations. If aerial_ground = TRUE, there should be an aerial_ground column in the input clean_pur_df data frame. There will be a value of exposure calculated for each chemical ("all" or by chemical class) and for each method of application: aerial or ground. The default is FALSE.

verbose

TRUE / FALSE for whether you would like a message to print out while the function is running. The default is TRUE.

...

Used internally.

Value

A list with five elements:

exposure

A data frame with 9 columns: exposure, the estimate of exposure in kg/m^2, chemicals, (either "all", indicating that all active ingredients present in the clean_pur_df were summed or the chemical class(es) specified in the clean_pur_df data frame), start_date, end_date, aerial_ground, which can take values of "A" = aerial, "G" = ground, and "O" = others, (if the aerial_ground argument is FALSE, aerial_ground will be NA in the exposure data frame), location, radius, the radius in meters for the buffer extending from the location, and the longitude and latitude of the location.

meta_data

A data frame with 12 columns and at least one row for every section or township intersected by the specified buffer extending from the given location. Columns include pls, giving either the Public Land Survey (PLS) section (9 characters long) or township (7 characters long), chemicals, percent, the percent that the PLS unit is overlapped by the buffer, kg, the total amount of kg applied for the specified chemicals and date range in that section or township, kg_intersection, the amount of kilograms applied multiplied by the percent of overlap, start_date and end_date, aerial_ground, which can take values of "A" (aerial), "G" (ground), or "O" (other), and will be NA if exposure calculations did not take aerial/ground application into account, none_recorded, logical for whether any pesticide application was recorded for the specified section or township, date range, and chemicals, location, and radius.

buffer_plot_df

A data frame with 24 columns. Contains spatial plotting data for the buffer and overlapping sections or townships. You can use the df_plot function to quickly plot and get a rough idea of the area for which exposure was calculated, before moving on to other plot_* functions.

county_plot

A ggplot2 plot showing the location of your specified buffer in the context of the county. Depending on if your clean_pur_df data frame was summed by section or township, the county will be shown with the relevant PLS units.

clean_pur_df

The data frame supplied to the clean_pur_df argument, filtered to the county and date range for which exposure was calculated.

Note

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
library(magrittr)

clean_pur <- readRDS(system.file("extdata", "fresno_clean.rds",
                                 package = "purexposure"))
fresno_spdf <- readRDS(system.file("extdata", "fresno_spdf.rds",
                                   package = "purexposure"))
exposure_list <- calculate_exposure(clean_pur, location = "-120.098794, 36.532866",
                                    radius = 3000, spdf = fresno_spdf)

# specify time intervals
exp_list2 <- calculate_exposure(clean_pur,
                                location = "13883 Lassen Ave, Helm, CA 93627",
                                radius = 3000,
                                time_period = "4 months")
exp_list2$exposure

# calculate exposure by township
clean_pur2 <- pull_clean_pur(1995, counties = "san bernardino",
                             sum_application = TRUE, unit = "township")
exp_list3 <- calculate_exposure(clean_pur2,
                                location = "-116.45, 34.96",
                                radius = 5000)
df_plot(exp_list3$buffer_plot)
exp_list3$county_plot

# calculate exposure by specified chemical classes
# this is an example of `none_recorded = TRUE`
chemical_class_df <- rbind(find_chemical_codes(2000, "methylene"),
                           find_chemical_codes(2000, "aldehyde")) 
   dplyr::rename(chemical_class = chemical)
exp_list4 <- pull_clean_pur(1995, "fresno",
                            chemicals = chemical_class_df$chemname,
                            sum_application = TRUE,
                            sum = "chemical_class",
                            chemical_class = chemical_class_df) 
   calculate_exposure(location = "13883 Lassen Ave, Helm, CA 93627",
                      radius = 1500,
                      chemicals = "chemical_class")
exp_list4$meta_data

# incorporate aerial/ground application information
exp_list5 <- pull_clean_pur(2000, "yolo") 
   calculate_exposure(location = "-121.9018, 38.7646",
   radius = 2500,
   aerial_ground = TRUE)
exp_list5$exposure

leighseverson/purexposure documentation built on Aug. 13, 2021, 6:34 p.m.