knn2nb(spdep)
knn2nb()所属R语言包:spdep
Neighbours list from knn object
邻居KNN对象列表
译者:生物统计家园网 机器人LoveR
描述----------Description----------
The function converts a knn object returned by knearneigh into a neighbours list of class nb with a list of integer vectors containing neighbour region number ids.
该函数将一个knn返回knearneigh成一个邻居列表类的对象nb的列表包含邻域数IDS的整数向量。
用法----------Usage----------
knn2nb(knn, row.names = NULL, sym = FALSE)
参数----------Arguments----------
参数:knn
A knn object returned by knearneigh
一个KNN对象返回的knearneigh
参数:row.names
character vector of region ids to be added to the neighbours list as attribute region.id, default seq(1, nrow(x))
字符区域的id被添加到向量的邻居列表的属性region.id,默认seq(1, nrow(x))
参数:sym
force the output neighbours list to symmetry
强制输出对称邻居列表
值----------Value----------
The function returns an object of class nb with a list of integer vectors containing neighbour region number ids. See card for details of “nb” objects.
该函数返回一个类的对象nb的列表包含邻域数IDS的整数向量。见card的“NB”对象的详细信息。
(作者)----------Author(s)----------
Roger Bivand <a href="mailto:Roger.Bivand@nhh.no">Roger.Bivand@nhh.no</a>
参见----------See Also----------
knearneigh, card
knearneigh,card
实例----------Examples----------
example(columbus)
coords <- coordinates(columbus)
col.knn <- knearneigh(coords, k=4)
plot(columbus, border="grey")
plot(knn2nb(col.knn), coords, add=TRUE)
title(main="K nearest neighbours, k = 4")
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|