Description Usage Arguments Value Examples
plot_county_application returns a plot of applied pesticides (either the
sum of all active ingredients present in the input pull_clean_pur data
frame, a specified chemical class, or a specified active ingredient). Application
is summed by section or township. PLS units can be shaded by amount or by
percentile.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17  | 
clean_pur_df | 
 A data frame returned by   | 
county | 
 Optional. If your   | 
pls | 
 Optional. Either "section" or "township". If your
  | 
color_by | 
 Either "amount" (the default) or "percentile". Specifies
whether you would like application amounts to be colored according to
amount, resulting in a gradient legend, or by the percentile that they fall
into for the given data set and date range. You can specify percentile
cutpoints with the   | 
percentile | 
 A numeric vector in (0, 1) specifying percentile cutpoints
if   | 
start_date | 
 Optional. "yyyy-mm-dd" giving a starting date for the date
range that you would like to map application for. The default is to plot
application for the entire date range in your   | 
end_date | 
 Optional. "yyyy-mm-dd" giving an ending date for the date
range that you would like to plot application for. The default is to plot
application for the entire date range in your   | 
chemicals | 
 Either "all" (the default) to plot summed active ingredients
present in your   | 
fill | 
 A palette from the colormap package. The default is
"viridis". To see colormap palette options, visit
https://bhaskarvk.github.io/colormap/ or run
  | 
crop | 
 TRUE / FALSE for whether you would like your plot zoomed in on sections or townships with recorded application data.  | 
alpha | 
 A number in [0,1] specifying the transparency of fill colors. Numbers closer to 0 will result in more transparency. The default is 1.  | 
ggmap_background | 
 TRUE / FALSE for whether you would like a ggmap background.  | 
polygon_color | 
 passed to the   | 
polygon_size | 
 passed to the   | 
... | 
 Used internally.  | 
A list with three elements:
A plot of the county with application summed by section or township and colored by amount or by percentile.
A data frame with the plotted application data.
A data frame with two columns: percentile
and kg, giving the cut points for each percentile in the
clean_pur_df for the specified chemicals. This element of the list
is not returned if color_by = "amount".
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  | library(magrittr)
fresno_spdf <- readRDS(system.file("extdata", "fresno_spdf.rds",
                                   package = "purexposure"))
fresno_clean <- readRDS(system.file("extdata", "fresno_clean.rds",
                                    package = "purexposure"))
fresno_list <- fresno_clean %>% plot_county_application(spdf = fresno_spdf)
# plot all active ingredients
fresno_df <- pull_clean_pur(2000:2001, "fresno")
fresno_list <- plot_county_application(fresno_df,
                                      color_by = "percentile",
                                      percentile = c(0.2, 0.4, 0.6, 0.8))
fresno_list$map
head(fresno_list$data)
fresno_list$cutoff_values
# plot a specific active ingredient
fresno_list2 <- plot_county_application(fresno_df, pls = "township",
                                       chemicals = "sulfur",
                                       fill = "plasma")
fresno_list2$map
# plot a chemical class
chemical_class_df <- purrr::map2_dfr(2010, c("methidathion", "parathion",
                                             "naled", "malathion",
                                             "trichlorfon"),
                                     find_chemical_codes) 
     dplyr::mutate(chemical_class = "organophosphates") 
     dplyr::select(-chemical)
op_yuba <- pull_clean_pur(2010, "yuba",
                          chemicals = chemical_class_df$chemname,
                          verbose = F, sum_application = T,
                          sum = "chemical_class",
                          chemical_class = chemical_class_df) 
   plot_county_application()
op_yuba$map
 | 
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.