load_pis: Load eBird Status and Trends predictor importance data

View source: R/load.R

load_pisR Documentation

Load eBird Status and Trends predictor importance data

Description

Loads the predictor importance (PI) data from the stixel_summary.db sqlite database. PI estimates are provided for each stixel over which a model was run and are identified by a unique stixel ID in addition to the coordinates of the stixel centroid.

Usage

load_pis(path, ext, model = c("occurrence", "count"), return_sf = FALSE)

Arguments

path

character; directory that the Status and Trends data for a given species was downloaded to. This path is returned by ebirdst_download() or get_species_path().

ext

ebirdst_extent object; the spatiotemporal extent to filter the data to. The spatial component of the extent object must be provided in unprojected, latitude-longitude coordinates.

model

character; whether to make estimates for the occurrence or count model.

return_sf

logical; whether to return an sf object of spatial points rather then the default data frame.

Value

Data frame, or sf object if return_sf = TRUE, containing PI estimates for each stixel for either the occurrence or count models. The data are provided in a 'wide' format, with each row corresponding to the PI estimates for a give stixel for the occurrence count model, and the relative importance of each predictor in columns. Stixels are identified by a unique stixel_id, and the centroid of the stixel in space and time is specified by the latitude, longitude, and day_of_year columns. The column predictor provides a code specifying the predictor variable. These codes can be looked up in ebirdst_predictors for a brief description.

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 for the occurrence model
pis <- load_pis(path)

# plot the top 15 predictor importances
# define a spatiotemporal extent to plot data from
bb_vec <- c(xmin = -86.6, xmax = -82.2, ymin = 41.5, ymax = 43.5)
e <- ebirdst_extent(bb_vec, t = c("05-01", "05-31"))
plot_pis(pis, ext = e, n_top_pred = 15, by_cover_class = TRUE)

## End(Not run)

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