"rshift"(X, ..., group=NULL, which=NULL)
"psp"
.
rshift.ppp
.
X
,
or NULL
indicating that all line segments belong to the same group.
Each group will be shifted together, and
separately from other groups.
group
.
"psp"
).
The function rshift
is generic. This function rshift.psp
is the method for line segment patterns.
The line segments of X
are first divided into groups,
then the line segments within a group are shifted by a common
random displacement vector. Different groups of line segments are shifted
independently.
If the argument group
is present, then this determines the grouping.
Otherwise, all line segments belong to a single group.
The argument group
should be a factor, of length equal to the
number of line segments in X
.
Alternatively group
may be NULL
,
which specifies that all line segments of X
belong to a single group.
By default, every group of line segments will be shifted.
The argument which
indicates that only some of the groups
should be shifted, while other groups should be left unchanged.
which
must be a vector of levels of group
indicating which groups are to be shifted.
The displacement vector, i.e. the vector by which the data line segments are shifted, is generated at random. The default behaviour is to generate a displacement vector at random with equal probability for all possible displacements. This means that the $x$ and $y$ coordinates of the displacement vector are independent random variables, uniformly distributed over the range of possible coordinates.
Alternatively, the displacement vector can be generated by
another random mechanism, controlled by the arguments
radius
, width
and height
.
The argument edge
controls what happens when
a shifted line segment lies partially or completely
outside the window of X
. Currently the only option is
"erode"
which specifies that the segments will be clipped
to a smaller window.
The optional argument clip
specifies a smaller window
to which the pattern should be restricted.
rshift
,
rshift.ppp
X <- psp(runif(20), runif(20), runif(20), runif(20), window=owin())
Y <- rshift(X, radius=0.1)
Run the code above in your browser using DataLab