[R-sig-Geo] times and ID records for sp

Michael Sumner mdsumner at utas.edu.au
Tue Apr 18 18:39:59 CEST 2006


Hello, I'm trying to figure out the best way to represent time-ordered 
records
in a SpatialPointsDataFrame.

In other contexts . . . I use a class "trip" which is simply a list of 
slots "x", "y", "time", "id"
and until now I've simply handled it as a list internally and defined 
methods
for as.list and as.data.frame - I'd like to write it as a SPDF.

What I'd mostly like to do is a single vector of class POSIXct/lt with 
names.
The names would act as a grouping factor for individual record sets 
within the
time-ordered records, and so validity functions would ensure that the 
times were
increasing within factors. Then I would have an extension to SPDF where one
column was "timeID" and handle all the trip information that way. I've 
toyed
with creating another slot (like coordinates) to hold a dataframe of 
timedates and
IDs, but it's mostly too complicated for me since POSIXt is S3 - I just 
don't understand how to setOldClass -,
and row names are (quite rightly) dropped in sp's AttributeList and so 
I'm kind of on the wrong track.

Nothing like asking a question: as I write this I think perhaps it 
should be a new slot that is a matrix (just like coords), and I just store
the times and IDs as integers with conversion methods when they are 
accessed . . . Then
the new class is an extension of SPDF (or perhaps of SpatialPoints - the 
time/IDs don't need to be considered
as "data" if the methods are all there).  I'd always assumed I would use 
POSIXt, but that can be wrapped in the accessor methods
I think. 

I'll try that out - thanks for listening, and I welcome any advice. I've 
toyed with some of the
irregular time series in its and zoo, but they seem like overkill for my 
purposes.


Cheers, Mike.




More information about the R-sig-Geo mailing list