depurate {paar} | R Documentation |
Remove errors from spatial data
Description
Data can be filtered by null, edge values, global outliers and spatial outliers or local defective observations. Default values are optimized for precision agricultural data.
Usage
depurate(
x,
y,
toremove = c("edges", "outlier", "inlier"),
crs = NULL,
buffer = -10,
ylimitmax = NA,
ylimitmin = 0,
sdout = 3,
ldist = 0,
udist = 40,
criteria = c("LM", "MP"),
zero.policy = NULL,
poly_border = NULL
)
Arguments
x |
an |
y |
|
toremove |
|
crs |
coordinate reference system: integer with the EPSG code,
or character with proj4string to convert coordinates if |
buffer |
|
ylimitmax |
|
ylimitmin |
|
sdout |
|
ldist |
|
udist |
|
criteria |
|
zero.policy |
default NULL, use global option value; if FALSE stop with error for any empty neighbors sets, if TRUE permit the weights list to be formed with zero-length weights vectors |
poly_border |
|
Details
Possible values for toremove
are one or more elements of:
- edges
All data points for a distance of
buffer
m from data edges are deleted.- outlier
Values that are outside the mean±
sdout
are removed- inlier
Local Moran index of spatial autocorrelation is calculated for each datum as a tool to identify inliers
Value
an object of class paar
with two elements:
- depurated_data
sf
object with the data after the removal process- condition
character
vector with the condition of each observation
References
Vega, A., Córdoba, M., Castro-Franco, M. et al. Protocol for automating error removal from yield maps. Precision Agric 20, 1030–1044 (2019). https://doi.org/10.1007/s11119-018-09632-8
Examples
library(sf)
data(barley, package = 'paar')
#Convert to an sf object
barley <- st_as_sf(barley,
coords = c("X", "Y"),
crs = 32720)
depurated <-
depurate(barley,
"Yield")
# Summary of depurated data
summary(depurated)
# Keep only depurate data
depurated_data <- depurated$depurated_data
# Combine the condition for all data
all_data_condition <- cbind(depurated, barley)