gda_knn_weights function

(For internally use and test only) K-Nearest Neighbors-based Spatial Weights

(For internally use and test only) K-Nearest Neighbors-based Spatial Weights

Create a k-nearest neighbors based spatial weights

gda_knn_weights( geoda_obj, k, power = 1, is_inverse = FALSE, is_arc = FALSE, is_mile = TRUE )

Arguments

  • geoda_obj: An instance of geoda
  • k: a positive integer number for k-nearest neighbors
  • power: (optional) The power (or exponent) of a number says how many times to use the number in a multiplication.
  • is_inverse: (optional) FALSE (default) or TRUE, apply inverse on distance value
  • is_arc: (optional) FALSE (default) or TRUE, compute arc distance between two observations
  • is_mile: (optional) TRUE (default) or FALSE, convert distance unit from mile to km.

Returns

An instance of Weight-class

Examples

## Not run: guerry_path <- system.file("extdata", "Guerry.shp", package = "rgeoda") guerry <- geoda_open(guerry_path) knn6_w <- gda_knn_weights(guerry, 6) summary(knn6_w) ## End(Not run)