View source: R/SOptim_CalcSegmentStats.R
zonalDT | R Documentation |
Calculate statistics for each element (e.g., a segment, object or region) based on data.table
objects
(much faster processing!).
zonalDT(x, z, fun, na.rm = TRUE, subset = NULL, ...)
## Default S3 method:
zonalDT(x, z, fun, na.rm = TRUE, subset = NULL, ...)
## S3 method for class 'data.frame'
zonalDT(x, z, fun, na.rm = TRUE, subset = NULL, ...)
## S3 method for class 'SpatRaster'
zonalDT(x, z, fun, na.rm = TRUE, subset = NULL, ...)
## S3 method for class 'matrix'
zonalDT(x, z, fun, na.rm = TRUE, subset = NULL, ...)
x |
An object of class |
z |
An object of class |
fun |
An aggregation function (e.g., |
na.rm |
A boolean defining whether or not to remove NA values (default: |
subset |
A vector defining which rows should be subset from z (zones or regions). |
... |
Further parameters to pass to |
A data.table object containing statistics by segment.
Both object must have exactly the same number of elements. For example, if x
and z
are
raster datasets these must have equal number of rows/columns, extent and coordinate reference system. If
x
is a data.frame
or matrix
then the number of cells in z
must equal the number
of rows in x
.
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.