spatialAverage: spatialAverage

Description Usage Arguments Value See Also Examples

View source: R/spatialAverage.R

Description

Averages spatially referenced data using a moving window

Usage

1
2
spatialAverage(data, xWindow, yWindow, spatialCoords, groups,
  na.ignore = FALSE)

Arguments

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 yWindow is not provided, the y coordinates can be omitted, otherwise they will be ignored. If spatialCoords is omitted, a moving window will be used, but data will not be spatially referenced prior to calculations.

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.

Value

A data.table of spatially averaged values

See Also

runmean

Examples

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")

jasonfischer/rivSurveyR documentation built on May 18, 2019, 5:54 p.m.