subset.mask | R Documentation |
Retain selected rows of a mask
object.
## S3 method for class 'mask'
subset(x, subset, ...)
## S3 method for class 'mask'
split(x, f, drop = FALSE, clusters = NULL, ...)
## S3 method for class 'mask'
rbind(...)
x |
|
subset |
numeric or logical vector to select rows of mask |
f |
factor or object that may be coerced to a factor |
drop |
logical indicating if levels that do not occur should be dropped (if f is a factor) |
clusters |
list of traps objects, each defining a cluster (alternative to f) |
... |
two or more |
The subscripts in subset
may be of type integer, character or
logical as described in Extract
.
The split
method may use either a factor f with one value for each row or a list of clusters, each a traps object. The output mask corresponding to each cluster is the subset of the original mask points that lie within buffer of a trap within the cluster; buffer is computed as the maximum distance between a mask point in x
and any detector in clusters
. Sub-masks specified with clusters
may overlap.
Covariates are ignored by rbind.mask
.
For subset
, an object of class ‘mask’ with only the requested
subset of rows and ‘type’ attribute set to ‘subset’.
For split
, a list of mask objects.
For rbind
, an object of class ‘mask’ with all unique rows from
the masks in ..., and ‘type’ attribute set to ‘rbind’.
The spacing attribute is carried over from the input (it is not updated automatically). In the case of very sparse masks (i.e. those with isolated points) this may lead to an unexpected value for this attribute. (Automatic updating requires excessive computation time and/or memory for very large masks).
mask
tempmask <- make.mask(make.grid())
OK <- (tempmask$x + tempmask$y) > 100
tempmask <- subset(tempmask, subset = OK)
plot(tempmask)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.