Learn R Programming

osc (version 1.0.5)

osc.buffer: Simple Buffer algorithm

Description

Simple buffer based on euclidean distance are created around all cells equal to one.

Usage

osc.buffer(input, width=max(dim(input)), return.width=F, complete=F)

Arguments

input

Matrix or Raster containing 1 indicating a cluster, no NA values are allowed

width

Width of the buffer in cells

return.width

Logical value, if TRUE then the distance to the nearest cell with value 1 will be returned for all cells within the buffer.

complete

Logical value, if TRUE the buffer will be increased until the whole raster is covered. Can only be used in combination with return.width=TRUE.

Value

Returns matrix or raster, depending on input, with 1 for cluster and -1 for surrounding buffer. If return.width=TRUE negative numbers indicating the distance (width) to the nearest cell with value 1.

Examples

Run this code
# NOT RUN {
data(landcover)
landcover[landcover[]>1] <- 0

plot(osc.buffer(landcover, 6))

plot(osc.buffer(landcover, 6, return.width = TRUE))

plot(osc.buffer(landcover, return.width = TRUE, complete = TRUE))

# }

Run the code above in your browser using DataLab