distance <- seq(-50, 50)
win <- 50
weight <- triangWeight(distance, win)
plot(distance, weight, type="l", main="triangWeight")
weight <- rectangWeight(distance, win)
plot(distance, weight, type="l", main="rectangWeight")
weight <- gaussWeight(distance, win)
plot(distance, weight, type="l", main="gaussWeight")
weight <- epWeight(distance, win)
plot(distance, weight, type="l", main="epWeight")
## simple example for a custom weighting function
ownWeighting <- function(distance, win) {
weight <- as.integer(abs(distance) < win)
return(weight)
}
Run the code above in your browser using DataLab