Convert various kinds of data to a point pattern on a linear network.
as.lpp(x=NULL, y=NULL, seg=NULL, tp=NULL, …,
marks=NULL, L=NULL, check=FALSE, sparse)
Vectors of cartesian coordinates, or any data
acceptable to xy.coords
.
Alternatively x
can be a point pattern
on a linear network (object of class "lpp"
)
or a planar point pattern (object of class "ppp"
).
Optional local coordinates. Vectors of the same length
as x,y
. See Details.
Ignored.
Optional marks for the point pattern. A vector or factor with one entry for each point, or a data frame or hyperframe with one row for each point.
Linear network (object of class "linnet"
)
on which the points lie.
Logical. Whether to check the validity of the spatial coordinates.
Optional logical value indicating whether to store the
linear network data in a sparse matrix representation or not.
See linnet
.
A point pattern
on a linear network (object of class "lpp"
).
This function converts data in various formats into a point pattern
on a linear network (object of class "lpp"
).
The possible formats are:
x
is already a point pattern on a linear network
(object of class "lpp"
).
Then x
is returned unchanged.
x
is a planar point pattern (object of class "ppp"
).
Then x
is converted to a point pattern on the linear network
L
using lpp
.
x,y,seg,tp
are vectors of equal length.
These specify that the i
th point has Cartesian coordinates
(x[i],y[i])
, and lies on segment number seg[i]
of the
network L
, at a fractional position tp[i]
along that
segment (with tp=0
representing one endpoint and
tp=1
the other endpoint of the segment).
x,y
are missing and seg,tp
are vectors of equal length
as described above.
seg,tp
are NULL
, and x,y
are data in a format
acceptable to xy.coords
specifying the
Cartesian coordinates.
Only the arguments x
and L
are given,
and x
is a data frame with one of the following types:
two columns labelled seg,tp
interpreted as local
coordinates on the network.
two columns labelled x,y
interpreted as Cartesian
coordinates.
four columns labelled x,y,seg,tp
interpreted as Cartesian coordinates and local coordinates.
lpp
.
# NOT RUN {
A <- as.psp(simplenet)
X <- runifpointOnLines(10, A)
is.ppp(X)
Y <- as.lpp(X, L=simplenet)
# }
Run the code above in your browser using DataLab