mask: Mask methods

View source: R/mask.R

maskR Documentation

Mask methods

Description

Filters the data that satisfy a condition.

Usage

mask(x, ...)

## Default S3 method:
mask(x, tol.mask = 0, ...)

## S3 method for class 'data.grid'
mask(x, mask = NULL, window = NULL, set.NA = FALSE, warn = FALSE, ...)

## S3 method for class 'bin.den'
mask(
  x,
  mask = mask.default(x$binw, npsp.tolerance(2)),
  window = NULL,
  set.NA = FALSE,
  warn = TRUE,
  ...
)

## S3 method for class 'bin.data'
mask(
  x,
  mask = NULL,
  window = NULL,
  set.NA = FALSE,
  warn = FALSE,
  filter.lp = TRUE,
  ...
)

## S3 method for class 'locpol.bin'
mask(
  x,
  mask = mask.default(x$binw, npsp.tolerance(2)),
  window = NULL,
  set.NA = FALSE,
  warn = TRUE,
  filter.lp = TRUE,
  ...
)

Arguments

x

object used to select a method (binned data, ...).

...

further arguments passed to or from other methods

tol.mask

tolerance.

mask

logical; vector (or array) indicating the selected values (not masked).

window

spatial window (values outside this window will be masked), currently an sp-object of class extending SpatialPolygons.

set.NA

logical; If TRUE, the values corresponding to masked cells are set to NA.

warn

logical; If TRUE a warning message is generated when original data is masked.

filter.lp

logical; If TRUE, masked nodes will be leaved out in local polynomial estimation.

Value

mask.default returns the logical vector x > tol.mask.

mask.bin.den, mask.bin.data and mask.locpol.bin return an object of the same class as x with the additional component $mask and optionally $window.

See Also

locpol, locpolhcv, binning, np.svar, npsp.tolerance.

Examples

mask(1:10, 5)
bin <- binning(aquifer[,1:2], aquifer$head, nbin = c(41,41), set.NA = TRUE)
str(mask(bin, mask(bin$binw), warn = TRUE))
str(mask(bin, mask(bin$binw, 1)))

rubenfcasal/npsp documentation built on April 23, 2023, 8:40 a.m.