Skip to content
Prev 139 / 15274 Next

How to set up an ITS object, just the basics?

(Post manually approved; Taher you may want to subscribe to the list with
this address --Dirk)
On Thu, Sep 30, 2004 at 03:22:31PM +0100, Taher Khan wrote:
It is really all there in the docs. The example section of help(its) has

   mat <- structure(1:6,dim=c(2,3),dimnames=list(c("2003-01-01","2003-01-04"),letters[1:3]))
   
which creates a matrix. Try class(mat), and then try  class(its(mat)).
Similarly 

   times <- as.POSIXct(strptime(c("1999-12-31 01:00:00","2000-01-01 02:00:00"),format="%Y-%m-%d %X"))

creates a POSIXct object which you can then use as the second argument to
its() -- try class(times) and class(its(mat,times)).

So in a nutshell, you can create its objects either way.  I tend to fill the
data and time components as two components, so 

   myIts <- its(myData, myDatesAsPosix) 
   
would be my choice.

Hope this helps, Dirk