import_shp: Import ESRI shapefiles

Description Usage Arguments Details Author(s) See Also Examples

Description

This is a wrapper for the shapefile function (from the raster package). It performs additonal checks on data covariates (converting all logical and character variables to factors) and prepares a 'fortified' version of SpatialPolygons objects data to allow ggplot-style plotting.

Usage

1
import_shp(x, fortify = TRUE, ...)

Arguments

x

file path of the shapefile including the file name (the file extension is not required since it is assumed to be .shp), or a SpatialPolygons or SpatialPoints object

fortify

if TRUE, a 'fortified' version of the spatial object will be returned (see Details)

...

additional arguments to pass to shapefile

Details

A list with two elements:

sp an object of class SpatialPolygons or SpatialPoints
fortified for polygon shapefiles, this will be the result of applying the fortify function to the sp element

Author(s)

Darren Kidney darrenkidney@googlemail.com

See Also

plot.gshp, import_data

Examples

1
2
3
4
5
6
7
## Not run: 

folder = system.file("extdata/N.annamensis", package = "gibbonsecr")
region = import_shp(file.path(folder, "region.shp"))
habitat = import_shp(file.path(folder, "habitat.shp"))

## End(Not run)

dkidney/gibbonsecr documentation built on May 15, 2019, 9:11 a.m.