getSpecies2: A wrapper function to download and plot a species...

Description Usage Arguments Details Value Warning Note Author(s) References See Also Examples

View source: R/getSpecies2.R

Description

A helper function for speciesInPolygon.

Usage

1
getSpecies2(species, client, plot = TRUE, region)

Arguments

species

The scientific or common name of a species.

client

The API server which to quiry to download distribution records for the selected species. See Details for available clients.

plot

Logic whether to plot the distribution of the selected species

region

The geographic region where the species occurs - typically the country, i.e. Australia.

Details

This function relies on the ALA4R and rgbif wrapper functions to quarier the API servers to download the distribution records for a specified species. The function first determines whether the species of interest occurs in Australia or outside of Australia. If the species occurs in Australia, then client = "ALA" and the Atlas of Living Australia (ALA) API server is quiried. If the species occurs outside of Australia, then client = "GBIF" and the Global Biodiversty Inforamtion Facility (GBIF) API server is quired. If plot = T, a new plotting window will open and the distirbution of the specified species will be plotted.

Value

Returns a data.frame containing three columns: species, Latitude, Longitude.

Warning

The code calls window() when plot = T. On Windows operating systmes, this option is relatively stable. However, on Mac operating systmes, window() can be quite buggy and can cause R to crash.

Note

The ALA4R and rgbif packages are only available from GitHub and are not yet on CRAN. To download these packages, use Hadley Wickham's devtools package. For example:

devtools::install_github("AtlasOfLivingAustralia/ALA4R") for ALA4R

devtools::install_github("ropensci/rgbif") for rgbif

Author(s)

P. A. Harrison

References

ALA spatail portal (http://spatial.ala.org.au/#)

ALA4R package (https://github.com/AtlasOfLivingAustralia/ALA4R)

GBIF (http://www.gbif.org/)

rgbif package (https://github.com/ropensci/rgbif)

See Also

speciesInPolygon, plotMyRegion

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
# not run

#' library(ALA4R)
library(rgbif)
library(raster)
library(sp)

# Download and plot the distribution for Eucalyptus ovata
# from the ALA server

#tmp <- PUCA::getSpecies2(species = "Eucalyptus ovata", client = "ALA",
#                         plot = TRUE, region = "Australia")

#head(tmp)
#            species Latitude Longitude
# 1 Eucalyptus ovata    -37.3     148.6
# 2 Eucalyptus ovata    -37.3     148.7
# 3 Eucalyptus ovata    -37.5     149.0
# 4 Eucalyptus ovata    -37.5     149.1
# 5 Eucalyptus ovata    -37.5     149.0
# 6 Eucalyptus ovata    -37.5     149.0

peteraharrison/PUCA documentation built on Sept. 16, 2019, 7:56 a.m.