as.Other | R Documentation |
Coercing trip
objects to other classes.
Function to create a SpatialLinesDataFrame from a trip object, resulting in a line segment for each implicit segment along the tracks. The object stores the start and end times, duration and the ID of the segment.
## S3 method for class 'trip'
as.ppp(X, ..., fatal)
## S3 method for class 'trip'
as.psp(x, ..., from, to)
as.track_xyt.trip(x, ..., from, to)
explode(x, ...)
X |
|
... |
reserved for future methods |
fatal |
Logical value, see Details of |
x |
|
from |
see |
to |
See |
ppp object
psp object
SpatialLinesDataFrame
SpatialLinesDataFrame object with each individual line segment identified by start/end time and trip ID
d <- data.frame(x=1:10, y=rnorm(10), tms=Sys.time() + 1:10, id=gl(2, 5))
sp::coordinates(d) <- ~x+y
tr <- trip(d, c("tms", "id"))
as(tr, "ppp")
d <- data.frame(x=1:10, y=rnorm(10), tms=Sys.time() + 1:10, id=gl(2, 5))
tr <- trip(d, c("tms", "id"))
as(tr, "psp")
as.psp(tr)
d <- data.frame(x=1:10, y=rnorm(10), tms=Sys.time() + 1:10, id=gl(2, 5))
tr <- trip(d)
spldf <- explode(tr)
summary(tr)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.