[R] Incorrect DateTime using ISOdatetime in R

Daniel Nordlund djnordlund at frontier.com
Fri Jan 20 19:16:40 CET 2012


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-project.org]
> On Behalf Of Sula2011
> Sent: Friday, January 20, 2012 7:00 AM
> To: r-help at r-project.org
> Subject: [R] Incorrect DateTime using ISOdatetime in R
> 
> Dear list,
> 
> I need to transform the DateTime of my GPS data from:
> 
> "666.1751" into "yyyy/mm/dd hh:mm:ss"
> 
> I have the following code:
> 
> d$Date <- ISOdatetime(2009, 1, 1, 0, 0, 0, tz = "GMT")+d$Date*(24*3600)
> 
> This gives me: 2010-10-29 04:12:09, which is wrong. It should be 2010-10-
> 29
> 06:12:09
> 
> Another example:
> 
> 418.3219 corresponds to: 2010-02-23 07:43:30, but it should be 2010-02-23
> 08:43:30.
> 
> However, not always is the difference + 2 h, it's sometimes less or more.
> 
> There are a lot of postings here regarding ISOdatetime, but I'm still not
> able to solve this . Any ideas or suggestions will be very much
> appreciated.
> 
> Best regards,
> 
> Julia
> 
> PS. I've tried to find the answer in all sorts of R help forums and also
> in
> my R books - no luck so far. Maybe I'm missunderstanding the entire
> ISOdatetime function?
> 

Julia, 

are the times from your GPS really GMT times, or are they your local time (it looks like you are in Germany)?  It looks like you are dealing with local times that are further complicated by changes between daylight and standard time.  Could that be the issue?

Dan

Daniel Nordlund
Bothell, WA USA
 



More information about the R-help mailing list