Hello all!

As beginner I'm struggling for a while with time zones issue and can't find
a suitable solution.
I would be grateful for any help.

Dataset imported from excel has a variable transplant.date which has been
recorded with CET time zone.

> subDataset$transplant.date
 [1] "2000-01-01 CET" "2000-01-01 CET" "2000-01-02 CET" "2000-01-02 CET"
"2000-01-02 CET" "2000-01-02 CET" "2000-01-04 CET" "2000-01-04 CET"
"2000-01-04 CET" "2000-01-04 CET" "2000-01-04 CET" "2000-01-05 CET"
"2000-01-05 CET"
[14] "2000-01-05 CET" "2000-01-05 CET"


However
> Sys.time()
[1] "2011-07-06 15:22:44 CEST"

I need to calculate time difference in days but I'm still getting wrong
calculations. Most likely is this time zone issue.


> as.numeric(as.Date("2000-1-1")-as.Date(subDataset$transplant.date))
[1] 1 1 0 0 0 0 -2 -2 -2 -2 -2 -3 -3 -3 -3


Truncation doesn't help either

>
trunc(as.Date("2000-1-1"),"days")-trunc(as.Date(subDataset$transplant.date),"days")
Time differences in days
 [1]  1  1  0  0  0  0 -2 -2 -2 -2 -2 -3 -3 -3 -3


Are there any useful tips to cope with this?

Thank you very much!
Laura

        [[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.

Reply via email to