Use segmented regression to create a species-area relationship (SAR) plot. The X axis represents log(island area) and the Y axis represents log(number of species)
Arguments
- occurrences
The dataframe output by
SSARP::find_areas()
(or if using a custom dataframe, ensure that it has the following columns: Species, areas)- npsi
The maximum number of breakpoints to estimate for model selection. Default: 1
Value
A list of 3 including: the summary output, the segmented regression object, and the aggregated dataframe used to create the plot
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...
seg <- create_SAR(areas)
summary <- seg[1]