Learn R Programming

spocc (version 0.2.2)

occ2sp: Occ output or data.frame to sp SpatialPointsDataFrame class

Description

Occ output or data.frame to sp SpatialPointsDataFrame class

Usage

occ2sp(input)

Arguments

input
Output from occ or a data.frame

Details

Note that you must have a column named latitude and a column named longitude - any additional columns are fine, but those two columns must exist. If you are using occ this will be done for you as you pass in the output of occ as an occdat class, but if you pass in a data.frame you should check this.

Examples

Run this code
spnames <- c('Accipiter striatus', 'Setophaga caerulescens', 'Spinus tristis')
out <- occ(query=spnames, from='gbif', limit=25, gbifopts=list(hasCoordinate=TRUE))

# pass in output of occ directly to occ2sp
occ2sp(out)

# or make a data.frame first, then pass in
mydf <- occ2df(out)
occ2sp(mydf)

Run the code above in your browser using DataLab