Description Usage Arguments Value Examples
View source: R/generate_bn_count_map.R
A function to generate a chloropleth map of results.
1 | generate_bn_count_map(df, taxon, relative = FALSE)
|
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. |
a ggplot object with a chloropleth map of the bad neighbor counts for states.
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)
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.