Perhaps you are getting warning messages from difftime like this: "Warning messages: 1: In structure(.Internal(as.POSIXct(x, tz)), class = c("POSIXt", "POSIXct"), : unable to identify current timezone 'V': please set environment variable 'TZ' 2: In structure(.Internal(as.POSIXct(x, tz)), class = c("POSIXt", "POSIXct"), : unknwon timezone 'localtime'"
Try execute the code two times. On Tue, Dec 9, 2008 at 3:33 PM, eric lee <[EMAIL PROTECTED]> wrote: > Hi. I'm trying to take the difference in days between two times. Can > you point out what's wrong, or suggest a different function? When I > try the following code, The following code works fine: > > a <- strptime(1911100807,format="%Y%m%d%H",tz="GMT") > b <- strptime(1911102718,format="%Y%m%d%H",tz="GMT") > x <- difftime(b, a, units="days") > x > > > But when I change the year, the following code returns 'NA' for the > time between a and b. Thanks. > > a <- strptime(1999100807,format="%Y%m%d%H",tz="GMT") > b <- strptime(1999102718,format="%Y%m%d%H",tz="GMT") > x <- difftime(b, a, units="days") > x > > ______________________________________________ > R-help@r-project.org mailing list > https://stat.ethz.ch/mailman/listinfo/r-help > PLEASE do read the posting guide > http://www.R-project.org/posting-guide.html > and provide commented, minimal, self-contained, reproducible code. > -- Henrique Dallazuanna Curitiba-Paraná-Brasil 25° 25' 40" S 49° 16' 22" O [[alternative HTML version deleted]]
______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.