OpenRange_load_species {OpenRange} | R Documentation |
Load Open Range maps for specified species.
Description
OpenRange_load_species returns spatial data for the specified species.
Usage
OpenRange_load_species(
species,
default_only = TRUE,
projection = 4326,
scenario = "present",
...
)
Arguments
species |
A single species or a vector of species. |
default_only |
Logical. Should only default ranges be included? Default is TRUE. |
projection |
Numeric. What projection should maps be returned in? 4326 (default) or 3857 |
scenario |
Which climate scenario(s) should be represented by maps? See BIEN_ranges_list_scenarios for options. |
... |
Additional arguments passed to internal functions. |
Value
A SpatialPolygonsDataFrame containing range maps for the specified species.
See Also
Other range functions:
OpenRange_api_load_species()
,
OpenRange_api_species()
,
OpenRange_get_license()
,
OpenRange_get_stats()
,
OpenRange_list_scenarios()
,
OpenRange_sf()
,
OpenRange_species()
Examples
#'
library(maps)
library(ggplot2)
library(sf)
species_vector <- c("Abies_lasiocarpa","Abies_amabilis")
abies_maps <- OpenRange_load_species(species = species_vector)
# To get all maps for a species, use "default = FALSE".
# Here, this returns maps with different thresholds from the same model
std_all <- OpenRange_load_species(species = "Stellaria debilis",
default_only = FALSE)
#To just get the default map, use "default = TRUE"
std_default <- OpenRange_load_species(species = "Stellaria debilis",
default_only = TRUE)
#get world map
world <- map("world", plot = FALSE, fill = TRUE)|>
st_as_sf()
#Plotting ranges
ggplot(data = world)+
geom_sf()+
geom_sf(data = abies_maps,
mapping = aes(fill = species),
alpha=0.5)+
coord_sf(xlim = st_bbox(abies_maps)[c(1,3)],
ylim = st_bbox(abies_maps)[c(2,4)]) +
theme_bw()
[Package OpenRange version 0.0.1 Index]