Skip to contents

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.

Usage

get_presence_absence(occs)

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

  • "specificEpithet" containing the names of the species living on those islands

  • "First" containing locality information. In the ssarp workflow, this column contains the country name

  • "Second" containing locality information. In the ssarp workflow, this column contains a province or island name

  • "Third" containing locality information. In the ssarp workflow, this column 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
# Read in example dataset filtered from:
#  dat <- rgbif::occ_search(taxonKey = 8782549,
#                           hasCoordinate = TRUE,
#                           limit = 10000)
dat <- read.csv(system.file("extdata",
                            "ssarp_Example_Dat.csv",
                            package = "ssarp"))
#> Warning: file("") only supports open = "w+" and open = "w+b": using the former
#> Error in read.table(file = file, header = header, sep = sep, quote = quote,     dec = dec, fill = fill, comment.char = comment.char, ...): no lines available in input
land <- find_land(occurrences = dat)
#> Error: object 'dat' not found
areas <- find_areas(occs = land)
#> Error: object 'land' not found
pres_abs <- get_presence_absence(areas)
#> Error: object 'areas' not found