displayNiche: Plot the climatic niche of a species

View source: R/displayNiche.R

displayNicheR Documentation

Plot the climatic niche of a species

Description

This function extracts worldclim data for a given spatial object and displays the worldclim data for the spatial points.

Usage

displayNiche(
  data,
  lon = "x",
  lat = "y",
  name = "worldclim",
  res = 10,
  variables = c("tmin", "tmax", "prec"),
  tres = "year",
  path = "",
  extent = NA,
  hist = FALSE,
  map = FALSE,
  download = TRUE
)

Arguments

data

raster layer or stack of the presence of one or multiple species, also takes a list

lon

Name of longitude column in data file, default x

lat

Name of latitude column in data file, default y

name

specifying which environmental data to use, currently only worldclim is supported.

res

specifying the desired spatial resolution. Valid resolutions are 0.5, 2.5, 5, 10 (minutes of a degree).

variables

specifying which variables to get, can be tmin, tmax and/or prec or bio.

tres

specifying the desired temporal resolution. One of year, month, quarter.

path

Character. Path name indicating where to store the data. Default is the current working directory.

extent

specify extent of area considered

hist

logical. specify if a histogram should be added to the plot.

map

logical. specify if a map should be added to the plot.

download

logical. download worldclim data or not. If download=FALSE the bioclimatic variables need to be provided with the data that is inserted into the function and bioclimatic variables need to be named accordingly (bio1, bio2, ...).

Value

plot of climatic niche of species

Examples

# Load library
library(climateNiche)

# Load House sparrow data
data(Passer_domesticus)

# Create plot of climatic niche
displayNiche(data=Passer_domesticus, variables=c("tmax", "prec"), tres="month")

# Load Great sparrow data
data(Passer_motitensis)

# Create plot of climatic niche
displayNiche(data=Passer_motitensis, variables=c("tmin", "tmax", "prec"), tres="quarter")

# Create list of the two species
Passer_spp <- list(Passer_domesticus, Passer_motitensis)

# Create plot of climatic niche
displayNiche(data=Passer_spp, variables=c("tmin", "tmax"))

# Load data of the Somali sparrow & the Asian desert sparrow
data(Passer_castanopterus)
data(Passer_zarudnyi)

# Create list of four species
Passer_spp4 <- list(Passer_castanopterus, Passer_domesticus, 
                    Passer_motitensis, Passer_zarudnyi)

# Create plot of climatic niche
displayNiche(data=Passer_spp4, variables=c("tmin", "tmax", "prec"))

RS-eco/climateNiche documentation built on Feb. 21, 2023, 5:25 a.m.