"ppp"representing a point pattern dataset in the two-dimensional plane.
ppp(x,y, ..., window, marks, check=TRUE)
owinto create the window, if
FALSEunless you are sure that this check is unnecessary.
"ppp"describing a point pattern in the two-dimensional plane (see
ymust lie inside the specified window, in order to define a valid object of class
"ppp". Any points which do not lie inside the window will be removed from the point pattern, and a warning will be issued.
The rejected points are still accessible: they are stored
as an attribute of the point pattern called
(which is an object of class
"ppp" containing the rejected points
in a large window). However, rejected points in a point pattern
will be ignored by all other functions except
To remove the rejected points altogether,
as.ppp. To include the rejected points,
you will need to find a larger window that contains them,
and use this larger window in a call to
"ppp". This function creates such objects.
y must be numeric vectors of
equal length. They are interpreted as the cartesian coordinates
of the points in the pattern.
A point pattern dataset is assumed to have been observed within a specific
region of the plane called the observation window.
An object of class
"ppp" representing a point pattern
contains information specifying the observation window.
This window must always be specified when creating a point pattern dataset;
there is intentionally no default action of ``guessing'' the window
dimensions from the data points alone.
You can specify the observation window in several (mutually exclusive) ways:
xrange, yrangespecify a rectangle with these dimensions;
polyspecifies a polygonal boundary. If the boundary is a single polygon then
polymust be a list with components
x,ygiving the coordinates of the vertices. If the boundary consists of several disjoint polygons then
polymust be a list of such lists so that
poly[[i]]$xgives the$x$coordinates of the vertices of the$i$th boundary polygon.
maskspecifies a binary pixel image with entries that are
TRUEif the corresponding pixel is inside the window.
windowis an object of class
owin.object) specifying the window.
maskare passed to the window creator function
owinfor interpretation. See
owinfor further details.
window, if given, must be an object of class
"owin". It is a full description of the window geometry,
and could have been obtained from
as.owin, or by just extracting the observation window
of another point pattern, or by manipulating such windows.
owin or the Examples below.
The points with coordinates
must lie inside the specified window, in order to
define a valid object of this class.
Any points which do not lie inside the window will be
removed from the point pattern, and a warning will be issued.
See the section on Rejected Points.
The name of the unit of length for the
can be specified in the dataset, using the argument
unitname, which is
owin. See the examples below, or the help file
The optional argument
marks is given if the point pattern
is marked, i.e. if each data point carries additional information.
For example, points which are classified into two or more different
types, or colours, may be regarded as having a mark which identifies
which colour they are. Data recording the locations and heights of
trees in a forest can be regarded as a marked point pattern where the
mark is the tree height.
In the current implementation,
marks must be a vector, of
the same length as
y, which is interpreted so
marks[i] is the mark attached to the point
(x[i],y[i]). If the mark is a real number then
should be a numeric vector, while if the mark takes only a finite
number of possible values (e.g. colours or types) then
marks should be a
ppp.object for a description of the
Users would normally invoke
ppp to create a point pattern,
but the functions
scanpp may sometimes be convenient.
# some arbitrary coordinates in [0,1] x <- runif(20) y <- runif(20) # the following are equivalent X <- ppp(x, y, c(0,1), c(0,1)) X <- ppp(x, y) X <- ppp(x, y, window=owin(c(0,1),c(0,1))) # specify that the coordinates are given in metres X <- ppp(x, y, c(0,1), c(0,1), unitname=c("metre","metres")) plot(X) # marks m <- sample(1:2, 20, replace=TRUE) m <- factor(m, levels=1:2) X <- ppp(x, y, c(0,1), c(0,1), marks=m) plot(X) # polygonal window X <- ppp(x, y, poly=list(x=c(0,10,0), y=c(0,0,10))) plot(X) # copy the window from another pattern data(cells) X <- ppp(x, y, window=cells$window)
Run the code above in your browser using DataCamp Workspace