View source: R/side_functions.R
adjustSpatialWeights | R Documentation |
Function to adjust the spatial weights so that they represent semantic distances between neighbours
adjustSpatialWeights(data, listw, style, mindist = 1e-11)
data |
A dataframe with numeric columns |
listw |
A nb object from spdep |
style |
A letter indicating the weighting scheme (see spdep doc) |
mindist |
A minimum value for distance between two observations. If two neighbours have exactly the same values, then the euclidean distance between them is 0, leading to an infinite spatial weight. In that case, the minimum distance is used instead of 0. |
A listw object (spdep like)
data(LyonIris)
AnalysisFields <-c("Lden","NO2","PM25","VegHautPrt","Pct0_14","Pct_65","Pct_Img",
"TxChom1564","Pct_brevet","NivVieMed")
dataset <- sf::st_drop_geometry(LyonIris[AnalysisFields])
queen <- spdep::poly2nb(LyonIris,queen=TRUE)
Wqueen <- spdep::nb2listw(queen,style="W")
Wqueen2 <- adjustSpatialWeights(dataset,queen,style="C")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.