Description Usage Arguments Value See Also Examples
View source: R/spatialAverage.R
Averages spatially referenced data using a moving window
1 2 | spatialAverage(data, xWindow, yWindow, spatialCoords, groups,
na.ignore = FALSE)
|
data |
Dataset containing data to be averaged and x, y coordinates |
xWindow |
Number of neighbors to include in the x orientation of the moving window, including the observation the window centers on. |
yWindow |
Optional. Number of neighbors to include in the y orientation of the moving window, including the observation the window centers on. |
spatialCoords |
A vector of column name(s) containing spatial coordinates within the dataset. The x coordinates must be designated first, followed by the y coordinates. If |
groups |
Optional. Names of column(s) containing information used to subset the data into separate groups for processing. Useful if dataset contains multiple discrete study areas. |
na.ignore |
Logical. If FALSE (default) NA values are assumed to be the average of non-NA values within the moving window, if TRUE NA values remain NA. |
A data.table of spatially averaged values
runmean
1 2 3 4 5 6 | data(vels)
#Average velocities along ADCP transects
velSpatialMean <- spatialAverage(vels, 21, spatialCoords = "tDist", groups = "transectName")
#Average velocities along ADCP transects and ensembles
data(cellVels)
velSpatialMean <- spatialAverage(cellVels, 21, 5, spatialCoords = c("tDist","cellDepth"), groups = "transectName")
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.