Extract.ppp(spatstat)
Extract.ppp()所属R语言包:spatstat
Extract or Replace Subset of Point Pattern
提取或替换子集点格局
译者:生物统计家园网 机器人LoveR
描述----------Description----------
Extract or replace a subset of a point pattern. Extraction of a subset has the effect of thinning the points and/or trimming the window.
提取或替换一个点模式的一个子集。的一个子集的提取具有减薄点和/或修剪窗口的效果。
用法----------Usage----------
## S3 method for class 'ppp'
x[i, j, drop, ...]
## S3 replacement method for class 'ppp'
x[i, j] <- value
参数----------Arguments----------
参数:x
A two-dimensional point pattern. An object of class "ppp".
一个二维点模式。对象的类"ppp"。
参数:i
Subset index. Either a valid subset index in the usual R sense, indicating which points should be retained, or a window (an object of class "owin") delineating a subset of the original observation window.
子集的索引。一个有效的子集索引中的通常的R SENSE,指示应保留的点,或一个窗口(一个对象的类"owin")划定的一个子集的原始的观察窗。
参数:value
Replacement value for the subset. A point pattern.
替换值的子集。点模式。
参数:j
Redundant. Included for backward compatibility.
冗余。为了向后兼容。
参数:drop, ...
Ignored. These arguments are required for compatibility with the generic function.
忽略。这些参数都需要的通用功能的兼容性。
Details
详细信息----------Details----------
These functions extract a designated subset of a point pattern, or replace the designated subset with another point pattern.
这些功能中提取一个指定的点模式的子集,或更换另一个角度的模式指定的子集。
The function [.ppp is a method for [ for the class "ppp". It extracts a designated subset of a point pattern, either by “thinning” (retaining/deleting some points of a point pattern) or “trimming” (reducing the window of observation to a smaller subregion and retaining only those points which lie in the subregion) or both.
函数[.ppp是[类"ppp"的方法。提取一个指定的点模式的子集,无论是“疏”(保留/删除一些点的点模式)或“微调”(减少观察到一个较小的次区域和窗口,只保留那些点在于该次区域)或两者兼而有之。
The pattern will be “thinned” if i is a subset index in the usual R sense: either a numeric vector of positive indices (identifying the points to be retained), a numeric vector of negative indices (identifying the points to be deleted) or a logical vector of length equal to the number of points in the point pattern x. In the latter case, the points (x$x[i], x$y[i]) for which subset[i]=TRUE will be retained, and the others will be deleted.
的模式将被“薄”如果i的一个子集在平时的R SENSE指数:可以是数字矢量的正指数(确定要保留的点),一个数值向量的负指数(识别点被删除)或逻辑的矢量长度相等的点的数量在点图案x。在后一种情况下,点(x$x[i], x$y[i])subset[i]=TRUE将被保留,和其他人都将被删除。
The pattern will be “trimmed” if i is an object of class "owin" specifying a window of observation. The points of x lying inside the new window will be retained. Alternatively i may be a pixel image (object of class "im") with logical values; the pixels with the value TRUE will be interpreted as a window.
模式将“减肥”如果i是一个对象类"owin"指定窗口观察。点x的里面放着新的window将被保留。或者i可以是一个像素的图像(类的对象"im")与逻辑值的像素将被解释为一个窗口的值TRUE。
The function [<-.ppp is a method for [<- for the class "ppp". It replaces the designated subset with the point pattern value. The subset of x to be replaced is designated by the argument i as above.
函数[<-.ppp是[<-类"ppp"的方法。它取代了指定子集的点模式value。 x子被替换指定的参数i以上。
The replacement point pattern value must lie inside the window of the original pattern x. The ordering of points in x will be preserved if the replacement pattern value has the same number of points as the subset to be replaced. Otherwise the ordering is unpredictable.
更换点模式value必须位于窗口内的原有格局x。点的顺序在x将被保留,如果替换模式value具有作为要被替换的子集的相同数量的点。否则的顺序是不可预测的。
If the original pattern x has marks, then the replacement pattern value must also have marks, of the same type.
如果原始图案x有value还必须有标记,相同类型的标记,然后替换模式。
Use the function unmark to remove marks from a marked point pattern.
使用的功能unmark删除标记一个显着的点模式。
Use the function split.ppp to select those points in a marked point pattern which have a specified mark.
使用的功能split.ppp选择点标记点图案,其中有一个指定的标记。
值----------Value----------
A point pattern (of class "ppp").
点模式(类"ppp"“)。
警告----------Warnings----------
The function does not check whether window is a subset of x$window. Nor does it check whether value lies inside x$window.
该函数不检查是否window是一个子集x$window。也不会检查是否value在于内x$window。
(作者)----------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----------
ppp.object, owin.object, unmark, split.ppp, cut.ppp
ppp.object,owin.object,unmark,split.ppp,cut.ppp
实例----------Examples----------
data(longleaf)
# Longleaf pines data[长叶松树数据]
## Not run: [#不运行:]
plot(longleaf)
## End(Not run)[#(不执行)]
# adult trees defined to have diameter at least 30 cm[定义为具有直径至少为30厘米的成年树]
adult <- (longleaf$marks >= 30)
longadult <- longleaf[adult]
## Not run: [#不运行:]
plot(longadult)
## End(Not run)[#(不执行)]
# note that the marks are still retained.[请注意,仍然保留该商标。]
# Use unmark(longadult) to remove the marks[使用取消标记(longadult)删除标记]
# New Zealand trees data[新西兰树数据]
data(nztrees)
## Not run: [#不运行:]
plot(nztrees) # plot shows a line of trees at the far right[在最右边的图显示了一排树]
abline(v=148, lty=2) # cut along this line[切沿着这条线]
## End(Not run)[#(不执行)]
nzw <- owin(c(0,148),c(0,95)) # the subwindow[子窗口]
# trim dataset to this subwindow[修剪数据集,这个子窗口]
nzsub <- nztrees[nzw]
## Not run: [#不运行:]
plot(nzsub)
## End(Not run)[#(不执行)]
# Redwood data[红木数据]
data(redwood)
## Not run: [#不运行:]
plot(redwood)
## End(Not run)[#(不执行)]
# Random thinning: delete 60% of data[随机变薄:删除60%的数据]
retain <- (runif(redwood$n) < 0.4)
thinred <- redwood[retain]
## Not run: [#不运行:]
plot(thinred)
## End(Not run)[#(不执行)]
# Scramble 60% of data[争夺60%的数据]
modif <- (runif(redwood$n) < 0.6)
scramble <- function(x) { runifpoint(x$n, x$window) }
redwood[modif] <- scramble(redwood[modif])
# Lansing woods data - multitype points[蓝星树林数据 - 多类型分]
data(lansing)
# Hickory trees[山核桃树]
hicks <- split(lansing)$hickory
# Trees in subwindow[在子窗口树]
win <- owin(c(0.3, 0.6),c(0.2, 0.5))
lsub <- lansing[win]
# Scramble the locations of trees in subwindow, retaining their marks[在子窗口的争夺树木的位置,保留自己的商标]
lansing[win] <- scramble(lsub) %mark% (lsub$marks)
转载请注明:出自 生物统计家园网(http://www.biostatistic.net)。
注:
注1:为了方便大家学习,本文档为生物统计家园网机器人LoveR翻译而成,仅供个人R语言学习参考使用,生物统计家园保留版权。
注2:由于是机器人自动翻译,难免有不准确之处,使用时仔细对照中、英文内容进行反复理解,可以帮助R语言的学习。
注3:如遇到不准确之处,请在本贴的后面进行回帖,我们会逐渐进行修订。
|