plot_pis: Plot predictor importance (PI) box plots

View source: R/plot.R

plot_pisR Documentation

Plot predictor importance (PI) box plots

Description

For a given eBird Status and Trends species, produce a box plot showing the predictor importance (PI) for each of the predictors used in the occurrence model. Predictors are plotted in order from highest to lowest importance. Many function parameters allow for customized plots.

Usage

plot_pis(
  pis,
  ext,
  by_cover_class = TRUE,
  n_top_pred = 15,
  pretty_names = TRUE,
  plot = TRUE
)

Arguments

pis

data frame; predictor importance data from load_pis().

ext

ebirdst_extent object; the spatiotemporal extent over which to calculate PIs. This is required, since results are less meaningful over large spatiotemporal extents.

by_cover_class

logical; whether to aggregate the FRAGSTATS metrics (PLAND and ED) for the land cover classes into single values for the land cover classes.

n_top_pred

integer; how many predictors to show.

pretty_names

logical; whether to convert cryptic land cover codes to readable land cover class names.

plot

logical; whether to plot predictor importance or just return top predictors.

Value

Plots a boxplot of predictor importance and invisibly returns the PI data subset to just the top predictors, grouped and renamed according to by_cover_class and pretty_names.

Examples

## Not run: 
# download example data
path <- ebirdst_download("example_data", tifs_only = FALSE)
# or get the path if you already have the data downloaded
path <- get_species_path("example_data")

# load predictor importance
pis <- load_pis(path)

# define a spatiotemporal extent to plot data from
bb_vec <- c(xmin = -86, xmax = -83, ymin = 41.5, ymax = 43.5)
e <- ebirdst_extent(bb_vec, t = c("05-01", "05-31"))

top_pred <- plot_pis(pis, ext = e, n_top_pred = 10)
top_pred

## End(Not run)

CornellLabofOrnithology/stemhelper documentation built on Feb. 5, 2023, 9:59 a.m.