edges: Assign NA values to the neighborhood of a boundary cell

Description Usage Arguments Value See Also Examples

View source: R/edges.R

Description

Assigns NA value to all cells having a NA values within their w x w neighborhood.

Usage

1
edges(x, w, filename = "", ...)

Arguments

x

A Raster* object

w

Numeric. Size of the window around each cell. Must be an odd number.

filename

Character. Output file name including path to directory and eventually extension. Default is "" (output not written to disk).

...

Additional arguments passed to writeRaster

Value

Raster* object

See Also

focal

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
# Load raster package
library(raster)

# Open and stack ALS metrics
elev_p95 <- raster(system.file("extdata/examples/ALS_metrics_p95.tif",package="foster"))
cover <- raster(system.file("extdata/examples/ALS_metrics_cov_mean.tif",package="foster"))
Y_vars <- stack(elev_p95,cover)

# Remove edges in a 3 x 3 neighborhood
Y_vars_edges <- edges(Y_vars, w=3)

mqueinnec/foster documentation built on March 28, 2021, 4:27 p.m.