Skip to content
edzer edited this page Oct 6, 2013 · 17 revisions

Welcome to the spacetime wiki!

selection on trips/tracks

What we can do:

Tr[1:2] # returns a TracksCollection, and
Tr[2] # returns a Tracks object
Tr[2][1] # selects a Track object

selects the first two IDs; what we can't do yet:

Tr[list(1:2, 2:3)] # to select the first two trips from ID1, and trip 2 and 3 from ID2.
Tr[Muenster] # select those tracks that cross (object) Muenster

For the latter, we basically need a

over(Tr, geometry(Muenster))

to return the right indices.

simple manipulation of attributes

What we can't do yet

Tr$log_pm10 = log(Tr$pm10)

coercion:

we can already do

as(Tr, "data.frame") # convert to data.frame, trips separated by an NA record
as(Tr[1], "data.frame") # convert Tracks
as(Tr[1][1], "data.frame) # convert Track
as(Tr, "segments") # like data.frame, but record for each segment with all x0 y0 x1 y1 segments, and segment attributes

we still need:

as(Tr, "xts") # convert to time series
as(Tr, "STIDF") # convert to spatio-temporal points
as(Tr, "SpatialLines") # convert trips to SpatialLines, aggregate() would aggregate attributes
as(Tr, "SpatialPointsDataFrame") # simply "dump" as points with attributes

aggregation:

aggregate(Tr, "1 hour", mean) # compute 1-hourly mean attributes, change of geometry
aggregate(Tr, Muenster, max) # compute max of attributes, change geometry
Clone this wiki locally