Create a presence-absence dataframe for a given occurrence record dataframe
Source:R/get_presence_absence.R
get_presence_absence.Rd
Use a dataframe output by SSARP::find_areas()
to determine which species
occur on specific islands by creating a presence-absence dataframe. A 1
represents presence and a 0 represents absence.
Arguments
- occs
The dataframe output by
SSARP::find_areas()
, or if using a custom dataframe, ensure that it has the following named columns:"areas" containing the areas associated with the land masses of interest
"Species" containing the names of the species living on those islands
A 6th column containing locality information. In the SSARP workflow, this column is called "First" and contains the country name
A 7th column containing locality information. In the SSARP workflow, this column is called "Second" and contains a province or island name
An 8th column containing locality information. In the SSARP workflow, this column is called "Third" and contains the island name if the 7th column does not contain the island name
Value
A dataframe with a row for each island in the given occurrence record dataframe and a column for each species. Within each species column, a 1 represents the presence of that species on the island corresponding to the given row, and a 0 represents the absence of that species on the island corresponding to the given row.
Examples
# The GBIF key for the Anolis genus is 8782549
# Obtained with: key <- get_key(query = "Anolis", rank = "genus")
key <- 8782549
# Read in example dataset obtained through:
# dat <- get_data(key = key, limit = 100)
dat <- read.csv(system.file("extdata",
"SSARP_Example_Dat.csv",
package = "SSARP"))
land <- find_land(occurrences = dat)
areas <- find_areas(occs = land)
#> ℹ Recording island names...
#> ℹ Assembling island dictionary...
#> ℹ Adding areas to final dataframe...
pres_abs <- get_presence_absence(areas)