[R] timeDate & business day

Michael Toews mwtoews at sfu.ca
Tue Mar 13 06:59:29 CET 2007


Sadly, I don't know of any tutorials or much help on the web for R ... 
that doesn't mean it doesn't exist ... you might just have to look 
around for it (www.rseek.org is a good place to start)
I've learned almost everything I know through:
?strptime

Also check out the methods for the classes, for example:

methods(class="Date")
methods(class="POSIXct")

And certainly check their help pages ... there is loads of stuff here 
that I haven't discovered myself. (Note, if you are new to S3 classes .. 
if it begins with the method, then "." class, you only need to type the 
beginning. For example "summary(ymd)" ... not "summary.Date(ymd)" if 
"ymd" has `class(ymd) == "Date" `.

I think the fundamental things to know are there are three main 
DateTimeClasses:

  1. "POSIXct" - has date, time and optionally time-zone info -- very
     handy for using in data.frame objects (and frankly I think it
     should be renamed to "DateTime" since the class "POSIXct" has
     nothing really to do directly with date/times)
  2. "POSIXlt" - as far as I'm concerned, this is has the same
     functionality as "POSIXct", but it cannot be used in data.frame
     objects (and frankly, I think it should be deprecated in favour of
     #1 to reduce future confusion)
  3. "Date" - use this if you don't care about times or time-zones

But it would be nice to track down a good tutorial somewhere.
+mt

Young Cho wrote:
> Thanks so Michael! If you know of a tutorial or introductory document 
> about timeDate manipulation or time series manipulation in R, can you 
> share it? It is hard to find by googling... I'd very appreciate any 
> advice.



More information about the R-help mailing list