[R] years from as.POSIXlt

Prof Brian Ripley ripley at stats.ox.ac.uk
Wed Mar 10 08:21:49 CET 2004


On Wed, 10 Mar 2004, Thomas Petzoldt wrote:

(without copying me)

> Prof Brian Ripley wrote:
> 
> > See ?julian, which says 
> > 
> > Note:
> > 
> >      Other components such as the day of the month or the year are very
> >      easy to computes: just use 'as.POSIXlt' and extract the relevant
> >      component.
> > 
> 
> Hello,
> 
> unfortunately not all mentioned functions work on all machines. Where

No function is mentioned in that note!

>  > months(.leap.seconds)
> 
> works on all systems, a call to
> 
>  > julian(leap.seconds)

What is `leap.seconds'?

> julian(.leap.seconds)

works on Windows XP, of course.

> 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

What is `leap.seconds' on your machine?  It is an object that as.POSIXct 
is failing on, I suspect (try traceback() to be sure).

> 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
> 
>  >as.numeric(format(x, f="%d"))
> 
> works perfectly, so I do not understand what is wrong with julian()

Do *read* the advice on how to get yday quoted above.

-- 
Brian D. Ripley,                  ripley at stats.ox.ac.uk
Professor of Applied Statistics,  http://www.stats.ox.ac.uk/~ripley/
University of Oxford,             Tel:  +44 1865 272861 (self)
1 South Parks Road,                     +44 1865 272866 (PA)
Oxford OX1 3TG, UK                Fax:  +44 1865 272595




More information about the R-help mailing list