R: Erase parts of a Spatial* object

erase {raster} | R Documentation

## Erase parts of a Spatial* object

### Description

Erase parts of a Spatial* objects with another Spatial* object

### Usage

    ## S4 method for signature 'SpatialPolygons,SpatialPolygons'
    erase(x, y, ...)

### Arguments

`x` | Spatial* object
`y` | Spatial* object
`...` | Additional arguments (none)

### Value

Spatial*

### Author(s)

Robert J. Hijmans

### Examples

    if (require(rgdal) & require(rgeos)) {
    	p <- shapefile(system.file("external/lux.shp", package="raster"))
    	b <- as(extent(6, 6.4, 49.75, 50), 'SpatialPolygons')
    	projection(b) <- projection(p)
    	e <- erase(p, b)
    	plot(e)
    }

[Package raster version 2.5-8 Index]