Converts the dataset x to a line segment pattern
(an object of class "psp"; see psp.object for
an overview). 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.
The dataset x may be:
- an object of class
"psp" - a data frame with columns named
x0, y0, x1, y1that will be interpreted as the coordinates of the endpoints
of the segments - a data frame or matrix with exactly 4 columns
that will be interpreted as the coordinates
x0, y0, x1, y1of the endpoints of the segments - a data frame with columns named
xmid, ymid, length, anglethat will be interpreted as the coordinates of the segment
midpoints, the lengths of the segments, and the orientations of the
segments in radians - a structure with elements named
x0, y0, x1, y1or elements namedxmid, ymid, length, anglewhich will be interpreted as above.
The argument window is converted to a window object
by the function 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.
The function as.psp is generic, with methods for the
classes "psp", "data.frame", "matrix"
and a default method.
Point pattern datasets can also be created by the function
psp.