View source: R/registry_KNN_dist.R
registry_KNN_dist | R Documentation |
For each element included in reg_X, it identifies the k-nearest neighbors locations (among those included in reg_Y) according to an Euclidean distance metric. reg_X and reg_Y must be two 'ARPALdf' objects obtained using get_ARPA_Lombardia_xxx_registry'.
registry_KNN_dist(reg_X, reg_Y, k = 1)
reg_X |
Dataset of class 'ARPALdf' containing the stations list obtained as registry (from 'get_ARPA_Lombardia_xxx_registry' command). The object must contain the following colums: 'IDStation','NameStation','Longitude' and 'Latitude'. |
reg_Y |
Dataset of class 'ARPALdf' containing the stations list obtained as registry (from 'get_ARPA_Lombardia_xxx_registry' command). The object must contain the following colums: 'IDStation','NameStation','Longitude' and 'Latitude'. |
k |
Integer value. Represents the number of neighbors the user wants to identify. |
A data.frame object having the same length of reg_X. For each row (stations in reg_X) it contains the name and the IDStation code for the k-nearest neighbors.
if (require("tidyverse")) {
regAQ <- get_ARPA_Lombardia_AQ_registry()
regAQ <- regAQ %>% filter(Pollutant %in% c("PM10","Ammonia"))
regW <- get_ARPA_Lombardia_W_registry()
registry_KNN_dist(regAQ,regW,k=2)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.