# \donttest{
library(sf)
library(terra)
data(ralu.site)
xvars <- rast(system.file("extdata/covariates.tif", package="GeNetIt"))
skew <- function(x, na.rm = TRUE) {
if (na.rm) x <- x[!is.na(x)]
sum( (x - mean(x)) ^ 3) / ( length(x) * sd(x) ^ 3 )
}
# without buffer (values at point)
system.time( {
stats <- node.statistics(ralu.site, r = xvars[[-6]])
} )
# with 1000m buffer (values around points)
system.time( {
stats <- node.statistics(ralu.site, r = xvars[[-6]], buffer = 1000,
stats = c("min", "median", "max", "var", "skew"))
} )
# }
Run the code above in your browser using DataLab