[R] Processing calendar dates with R

Andy Bunn abunn at montana.edu
Fri Dec 5 00:40:22 CET 2003


See:
?DateTimeClasses
?as.POSIXct
?strptime
?difftime 


The example for  difftime should help:

(z <- Sys.time() - 3600)
Sys.time() - z                # just over 3600 seconds.

## time interval between releases of 1.2.2 and 1.2.3.
ISOdate(2001, 4, 26) - ISOdate(2001, 2, 26)

as.difftime(c("0:3:20", "11:23:15"))
as.difftime(c("3:20", "23:15", "2:"), format= "%H:%M")# 3rd gives NA

HTH, Andy




More information about the R-help mailing list