[R] POSIXlt error

Prof Brian Ripley ripley at stats.ox.ac.uk
Wed Jul 14 07:58:53 CEST 2010


Check out your timezone.  Did something change on that day?
You omitted the time, so it is trying to make sense of

"1982-01-01 00:00"

According to

http://en.wikipedia.org/wiki/Singapore_Standard_Time

that time did not exist in that time zone (which I am guessing is the 
one your computer is set to.  If I use TZ=Singapore I get

> as.POSIXlt("1982-01-01")
Error in as.POSIXlt.character("1982-01-01") :
   character string is not in a standard unambiguous format
> as.POSIXlt("1982-01-01 00:00")
Error in as.POSIXlt.character("1982-01-01 00:00") :
   character string is not in a standard unambiguous format
> as.POSIXlt("1982-01-01 01:00")
[1] "1982-01-01 01:00:00 SGT"
> x <- as.POSIXlt("1982-01-01 01:00")
> x - 60*60 # an hour earlier
[1] "1981-12-31 23:30:00 SGT"

On Wed, 14 Jul 2010, Ian Seow wrote:

> Oops, sorry! Here it is:
>
> R version 2.11.1 (2010-05-31)
> i386-pc-mingw32
>
> locale:
> [1] LC_COLLATE=English_Singapore.1252  LC_CTYPE=English_Singapore.1252
> LC_MONETARY=English_Singapore.1252 LC_NUMERIC=C
> [5] LC_TIME=English_Singapore.1252
>
> attached base packages:
> [1] grDevices datasets  splines   graphics  stats     tcltk     utils
> methods   base
>
> other attached packages:
> [1] svSocket_0.9-48 TinnR_1.0.3     R2HTML_2.1      Hmisc_3.8-2
> survival_2.35-8
>
> loaded via a namespace (and not attached):
> [1] cluster_1.12.3 grid_2.11.1    lattice_0.18-8 svMisc_0.9-57  tools_2.11.1
>
>
>
>
>
> On Wed, Jul 14, 2010 at 10:24 AM, Erik Iverson <eriki at ccbr.umn.edu> wrote:
>
>> Do you care to share your sessionInfo() , as the Posting Guide asks?
>>
>> I cannot reproduce on:
>>
>> R version 2.11.1 (2010-05-31)
>> i486-pc-linux-gnu
>>
>>
>>
>> On 07/13/2010 09:07 PM, Ian Seow wrote:
>>
>>> Hi, I'm encountering a strange error in POSIXlt... anyone got a clue on
>>> this?
>>>
>>>  as.POSIXlt("1982-01-01")
>>>>
>>> Error in as.POSIXlt.character("1982-01-01") :
>>>   character string is not in a standard unambiguous format
>>>
>>>> as.POSIXlt("1992-01-01")
>>>>
>>> [1] "1992-01-01"
>>>
>>>> as.POSIXlt("1972-01-01")
>>>>
>>> [1] "1972-01-01"
>>>
>>>> as.POSIXlt("1962-01-01")
>>>>
>>> [1] "1962-01-01"
>>>
>>
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.
>

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