as.psp(spatstat)
as.psp()所属R语言包:spatstat
Convert Data To Class psp
将数据转换为类PSP
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Tries to coerce any reasonable kind of data object to a line segment pattern (an object of class "psp") for use by the spatstat package.
试图强制任何合理的数据类型对象线段图(对象类"psp")spatstat包的使用。
用法----------Usage----------
as.psp(x, ..., from=NULL, to=NULL)
## S3 method for class 'psp'
as.psp(x, ..., check=FALSE, fatal=TRUE)
## S3 method for class 'data.frame'
as.psp(x, ..., window=NULL, marks=NULL, check=spatstat.options("checksegments"), fatal=TRUE)
## S3 method for class 'matrix'
as.psp(x, ..., window=NULL, marks=NULL, check=spatstat.options("checksegments"),
fatal=TRUE)
## S3 method for class 'owin'
as.psp(x, ..., check=spatstat.options("checksegments"), fatal=TRUE)
## Default S3 method:
as.psp(x, ..., window=NULL, marks=NULL,
check=spatstat.options("checksegments"), fatal=TRUE)
参数----------Arguments----------
参数:x
Data which will be converted into a line segment pattern
的数据将被转换成线段图案
参数:window
Data which define a window for the pattern when x does not contain a window
定义一个窗口用于图案,当x不包含一个窗口的数据
参数:...
Ignored.
忽略。
参数:marks
(Optional) vector or data frame of marks for the pattern
(可选)矢量模式或数据框的标志
参数:check
Logical value indicating whether to check the validity of the data, e.g. to check that the line segments lie inside the window.
逻辑值,该值指示是否检查数据的有效性,例如:检查窗口内的线段。
参数:fatal
Logical value. See Details.
逻辑值。查看详细信息。
参数:from,to
Point patterns (object of class "ppp") containing the first and second endpoints (respectively) of each segment. Incompatible with x.
含有每个段的第一和第二端点(分别)的点图案(对象类"ppp")。不相容的x。
Details
详细信息----------Details----------
Converts the dataset x to a line segment pattern (an object of class "psp"; see psp.object for an overview).
将数据集转换x线段模式(类的一个对象"psp";看到psp.object的概述)。
This function is normally used to convert an existing line segment pattern dataset, stored in another format, to the "psp" format. To create a new point pattern from raw data such as x,y coordinates, it is normally easier to use the creator function psp.
此功能通常用于转换现有的线段模式数据集,存储在另一种格式,"psp"格式。要创建一个新的模式从原始数据,如x,y坐标点,它通常是更容易,使用creator功能psp。
The dataset x may be:
的数据集x可能是:
an object of class "psp"
一个对象的类"psp"
a data frame with at least 4 columns
至少有4列的数据框
a structure (list) with elements named x0, y0, x1, y1 or elements named xmid, ymid, length, angle and possibly a fifth element named marks
的结构(列表)的元素命名为x0, y0, x1, y1或元素命名为xmid, ymid, length, angle可能是第五元素命名为marks
an object of class "owin" representing a spatial window; it must be of type "rectangle" or "polygonal". The boundary edges of the window will be extracted as a line segment pattern.
类的一个对象"owin"空间窗口,它必须是类型"rectangle"或"polygonal"。将提取的窗口边界的边缘线段模式。
If x is a data frame the interpretation of its columns is as follows:
如果x是一个数据框的解释其列如下:
If there are columns named x0, y0, x1, y1 then these will be interpreted as the coordinates of the endpoints of the segments and used to form the ends component of the psp object to be returned.
如果有列名为x0, y0, x1, y1然后这些将被解释为线段的端点的坐标和用于形成endspsp对象的组成部分,要返回。
If there are columns named xmid, ymid, length, angle then these will be interpreted as the coordinates of the segment midpoints, the lengths of the segments, and the orientations of the segments in radians and used to form the ends component of the psp object to be returned.
如果有列名为xmid, ymid, length, angle那么这些将被解释为段的中点,各段的长度,和以弧度为单位的段的取向的坐标和用于形成ends分量的psp对象被退回。
If there is a column named marks then this will be interpreted as the marks of the pattern provided that the argument marks of this function is NULL. If argument marks is not NULL then the value of this argument is taken to be the marks of the pattern and the column named marks is ignored (with a warning). In either case the column named marks is deleted and omitted from further consideration.
如果有一列名为marks那么这将解释作为模式参数marks这个功能是NULL的痕迹。如果参数marks非NULL那么这种说法的价值是商标的图案和列名为marks被忽略(警告)。在这两种情况下,列名为商标被删除,省略了进一步的考虑。
If there is no column named marks and if the marks argument of this function is NULL, and if after interpreting 4 columns of x as determining the ends component of the psp object to be returned, there remain other columns of x, then these remaining columns will be taken to form a data frame of marks for the psp object to be returned.
如果没有列名为这个函数参数marks如果marks是NULL,如果后解释4列x确定ends psp对象的组成部分,要返回,仍然有其他列的x,那么这些剩余的列将形成的psp对象要返回一个数据框的标记。
If x is a structure (list) with elements named x0, y0, x1, y1, marks or xmid, ymid, length, angle, marks, then the element named marks will be interpreted as the marks of the pattern provide that the argument marks of this function is NULL. If this argument is non-NULL then it is interpreted as the marks of the pattern and the element marks of x is ignored — with a warning.
如果x,参数的元素命名为x0, y0, x1, y1, marks或xmid, ymid, length, angle, marks,然后名为marks的元素将被解释为商标的图案是一个结构(列表) marks这个功能是NULL。如果这种说法是非NULL然后它被解释为商标的图案和元素marksx被忽略 - 警告。
Alternatively, you may specify two point patterns from and to containing the first and second endpoints of the line segments.
或者,您可以指定两个点模式from和to第一和第二端点的线段。
The argument window is converted to a window object by the function as.owin.
参数window转换为一个窗口对象的功能as.owin。
The argument fatal indicates what to do when the data cannot be converted to a line segment pattern. If fatal=TRUE, a fatal error will be generated; if fatal=FALSE, the value NULL is returned.
参数fatal表示做什么时,数据不能被转换成线段模式。如果fatal=TRUE,这将产生一个致命的错误,如果fatal=FALSE,值NULL返回。
The function as.psp is generic, with methods for the classes "psp", "data.frame", "matrix" and a default method.
函数as.psp是通用的,方法的类"psp","data.frame","matrix"和一个默认的方法。
Point pattern datasets can also be created by the function psp.
点模式也可以创建数据集的功能psp。
值----------Value----------
An object of class "psp" (see psp.object) describing the line segment pattern and its window of observation. The value NULL may also be returned; see Details.
类的一个对象"psp"(psp.object)描述线段图案的窗口观察。值NULL还可以返回,查看详细信息。
警告----------Warnings----------
If only a proper subset of the names x0,y0,x1,y1 or xmid,ymid,length,angle appear amongst the names of the columns of x where x is a data frame, then these special names are ignored.
如果只有一个真子集的名字x0,y0,x1,y1或xmid,ymid,length,angle之间的xx是一个数据框,然后这些特殊的名字将被忽略的列名。
For example if the names of the columns were xmid,ymid,length,degrees, then these columns would be interpreted as if the represented x0,y0,x1,y1 in that order.
的列的名称,例如,如果是xmid,ymid,length,degrees,那么这些列将被解释为,如果表示x0,y0,x1,y1的顺序。
Whether it gets used or not, column named marks is always removed from x before any attempt to form the ends component of the psp object that is returned.
无论它被使用或不,名为marks列是始终从x之前形成的ends成分psp对象,则返回的任何企图。
(作者)----------Author(s)----------
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>
and Rolf Turner
<a href="mailto:r.turner@auckland.ac.nz">r.turner@auckland.ac.nz</a>
参见----------See Also----------
psp, psp.object, as.owin, owin.object
psp,psp.object,as.owin,owin.object
实例----------Examples----------
mat <- matrix(runif(40), ncol=4)
mx <- data.frame(v1=sample(1:4,10,TRUE),
v2=factor(sample(letters[1:4],10,TRUE),levels=letters[1:4]))
a <- as.psp(mat, window=owin(),marks=mx)
mat <- cbind(as.data.frame(mat),mx)
b <- as.psp(mat, window=owin()) # a and b are identical.[a和b是相同的。]
stuff <- list(xmid=runif(10),
ymid=runif(10),
length=rep(0.1, 10),
angle=runif(10, 0, 2 * pi))
a <- as.psp(stuff, window=owin())
b <- as.psp(from=runifpoint(10), to=runifpoint(10))
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|