Learn R Programming

red (version 1.6.1)

countries: Countries of occurrence.

Description

Extracts the names or ISO codes of countries of occurrence of a species based on either records or predicted distribution.

Usage

countries(spData, zone = NULL, ISO = FALSE)

Value

A vector with country names or codes.

Arguments

spData

One of three options: 1) matrix of longitude and latitude (two columns) of each occurrence record; 2) matrix of easting and northing (two columns, e.g. UTM) of each occurrence record in meters; 3) RasterLayer object of predicted distribution (0/1 values).

zone

UTM zone if data is in metric units.

ISO

Outputs either country names (FALSE) or ISO codes (TRUE).

Details

Country boundaries and designations are based on data(worldborders) from package maptools.

Examples

Run this code
records = red.examples("red.records")
range = red.examples("red.range")
countries(records)
countries(range, ISO = TRUE)

Run the code above in your browser using DataLab