Skip to contents

Use a dataframe output by ssarp::find_areas() to determine how many species occur on each island by creating a species richness dataframe.

Usage

get_richness(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

Value

A dataframe with two columns: the first containing island areas and the second containing the associated species richness (number of unique species)

Details

The output of this function can be used directly with the sars R package to fit additional SAR models that ssarp does not create itself.

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
richness <- get_richness(occs = areas)
#> Error: object 'areas' not found