as.Tracks: Convert Objects to Class Tracks

Description Usage Arguments Details Value Author(s) See Also Examples

View source: R/as.Tracks.R

Description

Coerces the Input Object of Class ASpaces to a Tracks Object

Usage

1
as.Tracks(x, sp, varname)

Arguments

x

an object of class ASpace

sp

an object of class sp used in x

varname

name of the column in sp's data.frame which can be matched

Details

Function as.Track accepts converts ASpace objects to an onject of class Tracks. When converting a single ASpace object, unlike the ASpaces class, there is basically no sp given, so it is essential to enter the sp argument.

Also, since the input of the time is fixed to the POSIXct or POSIXt class in the Tracks class, attention is needed that the existing time format is changed to the type of the corresponding class.

Value

An object of class Tracks

Author(s)

Seong-Yun Hong (syhong@khu.ac.kr)

See Also

as.Tracks

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
## Not run:
# creates sample info data
testinfo <- list()

# creates sample trip data
testtrip <- data.frame(tr_id = 1:10, tr_seq = rep(NA, 10), purpose = rep(NA, 10),
                      mode = rep(NA, 10), o_type = rep(NA, 10), 
                      o_time = c(200,300,400,500,600,700,800,900,1000,1100),
                      o_zone = c(1,2,3,4,5,6,5,4,3,2),
                      d_type = rep(NA, 10),
                      d_time = c(300,400,500,600,700,800,900,1000,1100,1200),
                      d_zone = c(2,3,4,5,6,5,4,3,2,1))
                    
#constructs an object of class 'ASpace'
testASpace <- new("ASpace", info = list(id = 1), trip = testtrip)

testTracks <- as.tracksCollection(testASpace, varname = "adm_dr_cd")

syunhong/slice documentation built on Feb. 7, 2021, 4:55 p.m.