找回密码
 注册
查看: 269|回复: 0

R语言 spatstat包 nnwhich()函数中文帮助文档(中英文对照)

[复制链接]
发表于 2012-9-30 13:50:52 | 显示全部楼层 |阅读模式
nnwhich(spatstat)
nnwhich()所属R语言包:spatstat

                                        Nearest neighbour
                                         最近的邻居

                                         译者:生物统计家园网 机器人LoveR

描述----------Description----------

Finds the nearest neighbour of each point in a point pattern.
找到最近的邻居的每一个点在一个点模式。


用法----------Usage----------


  nnwhich(X, ...)
  ## S3 method for class 'ppp'
nnwhich(X, ..., k=1, method="C")
  ## Default S3 method:
nnwhich(X, Y=NULL, ..., k=1, method="C")



参数----------Arguments----------

参数:X,Y
Arguments specifying the locations of a set of points. For nnwhich.ppp, the argument X should be a point pattern (object of class "ppp"). For nnwhich.default, typically X and Y would be numeric vectors of equal length. Alternatively Y may be omitted and X may be a list with two components x and y, or a matrix with two columns.  
指定的位置的一组点的引数。 nnwhich.ppp,参数X应该是一个点模式(类的对象"ppp"“)。对于nnwhich.default,通常X和Y将数字向量的长度相等。或者Y可以省略,并且X可以是带有两个组件的列表x和y,或一个具有两列的矩阵。


参数:...
Ignored by nnwhich.ppp and nnwhich.default.  
忽略nnwhich.ppp和nnwhich.default。


参数:k
Integer, or integer vector. The algorithm will compute the distance to the kth nearest neighbour.   
整数或整数向量。该算法计算距离的的k日最近的邻居。


参数:method
String specifying which method of calculation to use. Values are "C" and "interpreted".  
字符串,用于指定使用的计算方法。值是"C"和"interpreted"。


Details

详细信息----------Details----------

For each point in the given point pattern, this function finds its nearest neighbour (the nearest other point of the pattern). By default it returns a vector giving, for each point, the index of the point's nearest neighbour. If k is specified, the algorithm finds each point's kth nearest neighbour.
如果在给定的点图案中的每个点,此函数发现其近邻(最接近的其他点的图案)。默认情况下,它返回一个向量的付出,每一个点,该指数点的近邻。如果k指定的算法发现各点的k日最近的邻居。

The function nnwhich is generic, with method for point patterns (objects of class "ppp") and a default method which are described here, as well as a method for three-dimensional point patterns (objects of class "pp3", described in nnwhich.pp3.
的功能nnwhich是通用的,与点图案的方法(对象类"ppp")和一个默认的方法,该方法描述在这里,以及作为三维点图案的方法(类的对象的 "pp3",在nnwhich.pp3。

The method nnwhich.ppp expects a single point pattern argument X. The default method expects that X and Y will determine the coordinates of a set of points. Typically X and Y would be numeric vectors of equal length. Alternatively Y may be omitted and X may be a list with two components named x and y, or a matrix or data frame with two columns.
的方法nnwhich.ppp预计单点模式的话,X。默认的方法,希望这X和Y将确定一组点的坐标。通常情况下X和Y将数字向量的长度相等。或者Y可以省略,并且X可能是一个名为x和y,或具有两列的矩阵或数据框的两个组件列表。

The argument k may be a single integer, or an integer vector. If it is a vector, then the kth nearest neighbour distances are computed for each value of k specified in the vector.
参数k可能是一个整数或整数向量。如果它是一个向量,然后k个近邻距离k向量中指定的每个值的计算。

If there are no points (if x has length zero) a numeric vector of length zero is returned. If there is only one point (if x has length 1), then the nearest neighbour is undefined, and a value of NA is returned. In general if the number of points is less than or equal to k, then a vector of NA's is returned.
如果没有点(如果x长度为零的)返回长度为零的一个数值向量。如果只有一个点(如果x具有长度为1),那么最近的邻居是未定义的,和一个值NA返回。一般来说,如果点的数量小于或等于k,然后一个向量的NAs的返回。

The argument method is not normally used. It is retained only for checking the validity of the software. If method = "interpreted" then the distances are computed using interpreted R code only. If method="C" (the default) then C code is used.  The C code is faster by two to three orders of magnitude and uses much less memory.
参数method不能正常使用。它只会保留检查的软件的有效性。如果method = "interpreted"的距离计算仅使用解释R代码。如果method="C"(默认值),那么C代码使用。 C代码由两到三个数量级,速度更快,占用更少的内存。

To evaluate the distance between a point and its nearest neighbour, use nndist.
为了评估一个点之间的距离和离它最近的邻居,使用nndist。

To find the nearest neighbours from one point pattern to another point pattern, use nncross.
要找到最近的邻居模式从一个点到另一个点的模式,使用nncross。


值----------Value----------

Numeric vector or matrix giving, for each point, the index of its nearest neighbour (or kth nearest neighbour).
数字向量或矩阵,每一个点,给其最近的邻居(或k日最近的邻居)的索引。

If k = 1 (the default), the return value is a numeric vector v giving the indices of the nearest neighbours (the nearest neighbout of the ith point is the jth point where j = v[i]).
如果k = 1(默认值),则返回值是一个数值向量v给近邻指数(最近neighbout i个点是j个点j = v[i]“)。

If k is a single integer, then the return value is a numeric vector giving the indices of the kth nearest neighbours.
如果k是一个整数,则返回值是一个数值向量k日最近的邻居给的指标。

If k is a vector, then the return value is a matrix m such that m[i,j] is the index of the k[j]th nearest neighbour for the ith data point.
如果k是一个向量,则返回值是一个矩阵mm[i,j]是该指数的k[j]日最近的邻居i日数据点。


警告----------Warnings----------

A value of NA is returned if there is only one point in the point pattern.
返回值NA如果只有一个点的点模式。


(作者)----------Author(s)----------


Pavel Grabarnik
<a href="mailto:pavel.grabar@issp.serpukhov.su">pavel.grabar@issp.serpukhov.su</a>
and
Adrian Baddeley
<a href="mailto:Adrian.Baddeley@csiro.au">Adrian.Baddeley@csiro.au</a>
<a href="http://www.maths.uwa.edu.au/~adrian/">http://www.maths.uwa.edu.au/~adrian/</a>




参见----------See Also----------

nndist, nncross
nndist,nncross


实例----------Examples----------


   data(cells)
   plot(cells)
   m <- nnwhich(cells)
   m2 <- nnwhich(cells, k=2)

   # plot nearest neighbour links[绘制最近的邻居链接]
   b <- cells[m]
   arrows(cells$x, cells$y, b$x, b$y, angle=15, length=0.15, col="red")

   # find points which are the neighbour of their neighbour[这是他们的邻居的邻居找点]
   self <- (m[m] == seq(m))
   # plot them[绘制出来]
   A <- cells[self]
   B <- cells[m[self]]
   plot(cells)
   segments(A$x, A$y, B$x, B$y)

转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。


注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

手机版|小黑屋|生物统计家园 网站价格

GMT+8, 2025-6-15 23:09 , Processed in 0.023385 second(s), 16 queries .

Powered by Discuz! X3.5

© 2001-2024 Discuz! Team.

快速回复 返回顶部 返回列表