getGAUL: Extract GAUL codes for polygon occurrence data

Description Usage Arguments Value See Also Examples

View source: R/seegSDM.R

Description

Given a SpatialPointsDataFrame (occurrence) and a RasterBrick or RasterStack object containing raster layers of the four admin levels, extract GAUL codes for polygon records.

Usage

1

Arguments

occurrence

A SpatialPointsDataFrame of occurrence records containing at least a column named Admin giving the admin level of the polygon. Admin should be an integer from 0 to 3, or -9999 for point data.

admin

A RasterBrick or RasterStack object with four layers giving the GAUL codes for different admin levels. The layers must be in the order 0, 1, 2, 3, as they are in the example object admin.

Value

A SpatialPointsDataFrame identical to occurrence, with an additional column GAUL giving the GAUL codes for the polygons and NA for points.

See Also

SpatialPointsDataFrame, checkOccurrence, occurrence2SPDF

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
# load the occurrence and admin example objects
data(occurrence)
data(admin)

# convert occurrence into an SPDF
occurrence <- occurrence2SPDF(occurrence)

# look at occurrence
head(occurrence)

# note the order of admin
names(admin)

# extract GAUL codes
occurrence <- getGAUL(occurrence, admin)

# the GAUL colun has been added
head(occurrence)
tail(occurrence)

SEEG-Oxford/seegSDM documentation built on May 10, 2017, 10:25 a.m.