as.Other: As ("trip", other-classes)

Description Usage Arguments Value Examples

Description

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.

Usage

1
2
3
4
5
6
7
8
9
## 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, ...)

Arguments

X

trip object.

...

reserved for future methods

fatal

Logical value, see Details of as.ppp

x

trip object

from

see as.psp for that method.

to

See as.psp.

Value

ppp object

psp object

SpatialLinesDataFrame

SpatialLinesDataFrame object with each individual line segment identified by start/end time and trip ID

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
## Not run: 
 d <- data.frame(x=1:10, y=rnorm(10), tms=Sys.time() + 1:10, id=gl(2, 5))
sp::coordinates(d) <- ~x+y
## this avoids complaints later, but these are not real track data (!)
sp::proj4string(d) <- sp::CRS("+proj=laea +ellps=sphere",  doCheckCRSArgs = FALSE)
tr <- trip(d, c("tms", "id"))

 as(tr, "ppp")

## End(Not run)
## Not run: 
 d <- data.frame(x=1:10, y=rnorm(10), tms=Sys.time() + 1:10, id=gl(2, 5))
sp::coordinates(d) <- ~x+y
## this avoids complaints later, but these are not real track data (!)
sp::proj4string(d) <- sp::CRS("+proj=laea +ellps=sphere", doCheckCRSArgs = FALSE)
tr <- trip(d, c("tms", "id"))

 as.psp.trip(tr)

## End(Not run)
 d <- data.frame(x=1:10, y=rnorm(10), tms=Sys.time() + 1:10, id=gl(2, 5))
sp::coordinates(d) <- ~x+y
## this avoids complaints later, but these are not real track data (!)
sp::proj4string(d) <- sp::CRS("+proj=laea +ellps=sphere", doCheckCRSArgs = FALSE)
tr <- trip(d, c("tms", "id"))

spldf <- explode(tr)
summary(tr)

trip documentation built on March 16, 2021, 9:08 a.m.