as.tracksCollection: Convert Objects to Class tracksCollection

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

View source: R/as.tracksCollection.R

Description

Coerces the Input Object of Class ASpaces to a tracksCollection Object

Usage

1
as.tracksCollection(x, sp, varname)

Arguments

x

an object of class ASpaces

sp

an object of class sp used in x

varname

name of the column in sp's data.frame which can be matched with o_zone and d_zone in ASpaces

Details

Function as.trackCollection accepts converts ASpaces objects to an onject of class tracksCollection. In the conversion since the individual's travel position matches the position on the spatial data, care must be taken in selecting 'sp'. If 'sp' is not given, the 'sp' contained in ASpaces is selected.

Value

An object of class tracksCollection

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
18
19
20
## 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)

#constructs an object of class 'ASpaces'
testtASpaces <- new("ASpaces", data = list(testaspace), sp = testshp)

testTC <- as.tracksCollection(testASpaces, varname = "adm_dr_cd")

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