Skip to content
Prev 45635 / 398498 Next

years from as.POSIXlt

If you search the mail archives for fromchar there are a number
of discussions of similar bugs that all seem to come from 
German or other European users, suggesting locale problems.

I suspect it won't be easy for others to reproduce this
so you might try to see what you can track down yourself.
fromchar is in as.POSIXlt so perhaps you could
try to get the bug to appear by using as.POSIXlt 
directly and then debugging it using 

    debug(as.POSIXlt)

and as soon as it defines fromchar

    debug(fromchar)

In terms of an interim solution, you could use chron.
For example, for the .leap.seconds problem:

   require(chron)
   .leap.seconds.chron <- chron( format(.leap.seconds,"%m/%d/%Y"), 
                                 format(.leap.seconds,"%H:%M:%S") )
   as.numeric(.leap.seconds.chron) 

where the last line uses the fact that chron stores its dates 
internally as the number of days since January 1, 1970.

---
Date:   Wed, 10 Mar 2004 00:04:30 +0100 
From:   Thomas Petzoldt <thpe at hhbio.wasser.tu-dresden.de>
To:   <r-help at stat.math.ethz.ch> 
Subject:   Re: [R] years from as.POSIXlt
Prof Brian Ripley wrote:

            
Hello,

unfortunately not all mentioned functions work on all machines. Where
works on all systems, a call to
workes perfectly only on Linux (R 1.8.0) but failed on two different XP 
Machines (German XP version):

Error in fromchar(x) : character string is not in a standard unambiguous 
format

I've tested several things, several versions of msvcrt.dll, different 
PATH settings, locale set to German or USA, R 1.8.1 and R 1.7.1, but the 
problem remains.

On the other hand
works perfectly, so I do not understand what is wrong with julian()



Thomas P.