The goal of paar
is to provide useful functions for
precision agriculture spatial data depuration.
You can install the released version of paar from CRAN with (not-yet):
# install.packages("paar")
You can install the development version from GitHub with:
# install.packages("devtools")
::install_github("PPaccioretti/paar") devtools
The package has a complete protocol for automating error removal. Default values of all functions are optimized for precision agricultural data.
library(paar)
library(sf)
#> Warning: package 'sf' was built under R version 4.3.3
data("barley", package = 'paar')
barley
data contains barley grain yield which were
obtained using calibrated commercial yield monitors, mounted on combines
equipped with DGPS.
#Convert barley data to an spatial object
<- st_as_sf(barley,
barley_sf coords = c("X", "Y"),
crs = 32720)
<-
barley_dep depurate(barley_sf,
"Yield")
#> Concave hull algorithm is computed with
#> concavity = 2 and length_threshold = 0
# Summary of depurated data
summary(barley_dep)
#> normal point border spatial outlier MP spatial outlier LM
#> 5673 (77%) 964 (13%) 343 (4.6%) 309 (4.2%)
#> global min outlier
#> 99 (1.3%) 6 (0.081%)
Spatial yield values before and after depuration process can be plotted
plot(barley_sf["Yield"], main = "Before depuration")
plot(barley_dep$depurated_data["Yield"], main = "After depuration")
Also distribution of yield values can be plotted
boxplot(barley_sf[["Yield"]], main = "Before depuration")
boxplot(barley_dep$depurated_data[["Yield"]], main = "After depuration")