spp
representing a Spatial Point Pattern.
This object is a data frame with columns identifying the locations of
the observations. It could contain other columns as well.
spp(data, x, y, boundary=bbox(data), drop=F) is.spp(x) as.spp(x)
x
and
y
are not used then:
if
data
has columns named
"x"
and
"y"
,
these will be understood to contain the corresponding locational information;
otherwise, the first two columns will be assumed to contain the
necessary information. Use arguments
x
and
y
for other options.
If
data
is not specified then
x
and
y
must contain the coordinates.
data
is given, then
x
must be a character string or an integer
denoting one of the named columns of
data
.
If
data
is missing, then
x
must be a vector
giving the
x
-coordinates of the point pattern.
x
.
If
data
is given, then
y
must be a character string or an integer
denoting one of the named columns of
data
. This must be different
that the one indicated by
x
.
If
data
is missing, then
y
must be a vector
giving the
y
-coordinates of the point pattern.
"x"
and
"y"
denoting the vertices of
a convex polygon containing the point pattern. The first and last points
do not need to coincide. The default is to consider the pattern bounded
by a rectangle, its bounding box.
"data.frame"
) or
should the location information be extracted from
data
?
Default is FALSE, that is, leave all other columns intact.
spp
function returns an object of class
"spp"
.
This is essentially a data frame with two special attributes:
attribute
"coords"
which tells corresponding methods which columns
denote locational information; and attribute
"boundary"
which
contains the same information as entered in the argument
boundary
.
is.spp
function returns
TRUE
if
object
is of class
"spp"
and
FALSE
otherwise.
as.spp
function coerces a data frame or a matrix with at least
two columns to a spatial point pattern object, an object of class
"spp"
.
This function is provided to facilitate calls to methods that
act on a spatial point pattern such as the
plot
method.
The list to be entered as argument
boundary
can be obtained
in several different ways.
Use
scan
to read information that
may be available in ASCII files. Use
chull
or
bbox
to get the
convex hull or bounding box for the point pattern. You may follow
those calls by a call to the function
poly.expand
which will
"expand" the polygon by a given fraction keeping its original shape.
The list can also be obtained interactively from a graphics device by
plotting the
x
and
y
coordinates and using the output from
locator(type="l")
to represent the vertices of the surrounding polygon. If using the
latter method, the user must ensure that the resulting polygon is
convex, use the function
is.convex.poly
to this end.
lansing.m <- spp(lansing[lansing$species=="maple",]) # Make an spp object from the easting and northing locations of # the aquifer data frame: aquifer.xy <- spp(aquifer, drop=T) myunif <- spp(x=runif(100), y=runif(100))