[R] difftime
eric lee
ericlee100 at gmail.com
Tue Dec 9 18:33:44 CET 2008
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
More information about the R-help
mailing list