generate_bn_count_map: generate_bn_count_map

Description Usage Arguments Value Examples

View source: R/generate_bn_count_map.R

Description

A function to generate a chloropleth map of results.

Usage

1
generate_bn_count_map(df, taxon, relative = FALSE)

Arguments

df

a tibble. Typically the results from the process_bad_neighbor_groups function

taxon

a string. The [often informal] name of the taxon group to process (e.g. "Tree/Shrub")

relative

a boolean. Optionally add a title indicating the data are relative to the non-native species already in the state. The data processing is done outside the plot function.

Value

a ggplot object with a chloropleth map of the bad neighbor counts for states.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
Load a results file from process_bad_neighbor_groups() function
comb_all_results_forbs <- readr::read_csv("result_csv/forbs_comb_result.csv")

comb_all_results_trees %>% 
   group_by(state_name) %>% 
   summarize(species_count = sum(bad_neighbor_count)) %>% 
   # pass to the plot function
   generate_bn_count_map(taxon = "Tree/Shrub")
   
Show the results relative to the non-natives already present in the states
comb_all_results_trees %>% 
   group_by(state_name) %>% 
   # Normalize the data
   mutate(relative = bad_neighbor_count / state_nn_species_count) %>% 
   summarise(species_count = sum(relative)) %>% 
   generate_bn_count_map(taxon = "Tree/Shrub", relative = TRUE)

usgs-bis/bad-neighbor-invasives documentation built on Sept. 26, 2019, 7:34 a.m.