distance(sphet)
distance()所属R语言包:sphet
Writes distance matrices
写入距离矩阵
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Reads points coordinates and generates objects of class distance.matrix
读取点坐标并生成对象的类distance.matrix
用法----------Usage----------
distance(coord,region.id=NULL,output=TRUE,
type=c("NN","distance","inverse"),
measure=c("euclidean","gcircle","chebyshev","braycur","canberra"),
nn=6, cutoff=FALSE, miles=TRUE,R=NULL, shape.name=NULL,region.id.name=NULL,
firstline=FALSE,file.name=NULL)
参数----------Arguments----------
参数:coord
a matrix with the (X,Y)-coordinates of the points. The first column can be the region.id variable giving the ordering of the observations
与(X,Y)的坐标点的矩阵。第一列可以是region.id的变量,给人的观测值的排序
参数:region.id
variable that defines the ordering of the observations
变量定义的排序的观测
参数:output
when TRUE (default) writes the object to a file
当TRUE(默认值)的对象写入到一个文件中
参数:type
one of ("NN","distance","inverse"). Nearest neighbors, distance or inverse distance
一个("NN","distance","inverse")。最近的邻居,距离或反距离
参数:measure
one of ("euclidean","gcircle","chebyshev","braycur","canberra").The distance measure to be employed in the calculations.
一个("euclidean","gcircle","chebyshev","braycur","canberra")。措施,在计算距离。
参数:nn
the number of nearest neighbors
最近邻的数目
参数:cutoff
If type is distance or inverse. Assumes values 1, 2 or 3. When 1, the cutoff is set to the first quantile of the distribution of distances. When 2 to the median, and when 3 to the third quantile. Only observations with distance less than cutoff distance are neighbors.
如果类型是distance或inverse。假设值1,2或3。为1时,被设置为截止的距离的分布的第一位数。当2的中间值,并且,当3到第三分位数。只有观察的距离小于截止距离是邻居。
参数:miles
If TRUE (default), distances are in miles, otherwise in Km. (See rdist.earth for details)
如果是TRUE(默认),距离以英里,否则公里。 (见rdist.earth详情)
参数:R
Radius to use for sphere to find spherical distances.(See rdist.earth for details)
半径为使用领域找到球的距离。(见rdist.earth)
参数:shape.name
The name of the shape file. See Details
的形状文件的名称。查看详细资料
参数:region.id.name
The name of the region.id variable. See Details
region.id变量的名称。查看详细资料
参数:firstline
If TRUE, a first line is added to the output file. See Details
如果TRUE,第一线被添加到输出文件中。查看详细资料
参数:file.name
If output, the name of the output file. See Details
如果output,输出文件的名称。查看详细资料
Details
详细信息----------Details----------
The object created is similar to the content of a 'GWT' file. The output file can be of any format. In particular, it could be a 'GWT' file. When firstline is TRUE, an header line is added to the 'GWT' file. The first element is simply a place holder, the second is the number of observations. The name of the shape file and of the id variable can be specified by the options shape.name and region.id.name respectively. The function performs a series of test on the region.id variable. If a region.id variable is not specified and coord only has two columns, a sequence from 1 to the number of observations is generated and used as identification variable. If region.id is specified and the first column of coord contains an id variable they should be the same.
创建的对象是类似的,内容的'GWT'文件。输出文件可以是任何格式的。特别是,它可以是'GWT'文件。当firstlineTRUE,一个标题行添加到'GWT'文件。第一个元素是简单的持有人,二是观测的数量。 shape文件的名称和id变量,可以指定通过选项shape.name和region.id.name分别。 region.id变量的功能进行了一系列的测试。如果region.id变量没有被指定,coord只具有两列,观测值的数量从1到序列的产生和用于作为识别变量。如果region.id指定coord的第一列包含一个id变量,它们应该是相同的。
值----------Value----------
A matrix of three columns: from, to, and distance
Amatrix三列:from,to和distance
(作者)----------Author(s)----------
Gianfranco Piras <a href="mailto:gpiras@mac.com">gpiras@mac.com</a>
实例----------Examples----------
X<-runif(100,0,70)
Y<-runif(100,-30,20)
coord1<-cbind(seq(1,100),X,Y)
thm1 <- distance(coord1,region.id=NULL,output=TRUE,type="inverse", shape.name="shapefile",region.id.name="id1",firstline=TRUE,file.name="dist_100.GWT")
thm2 <- distance(coord1,region.id=NULL,output=FALSE,type="NN", nn=6)
thm2 <- distance(coord1,region.id=NULL,output=FALSE,type="distance", cutoff=1)
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|