[R] strange date problem - May 3, 1992 is NA
Luke Miller
millerlp at gmail.com
Wed Jun 22 21:09:48 CEST 2011
For what it's worth, I cannot reproduce this problem under a nearly
identical instance of R (R 2.12.1, Win 7 Pro 64-bit). I also can't
reproduce the problem with R 2.13.0. You've got something truly weird
going on with your particular instance of R.
> is.na(strptime("5/3/1992", format="%m/%d/%Y"))
[1] FALSE
> is.na(strptime("5/2/1992", format="%m/%d/%Y"))
[1] FALSE
> sessionInfo()
R version 2.12.1 (2010-12-16)
Platform: i386-pc-mingw32/i386 (32-bit)
locale:
[1] LC_COLLATE=English_United States.1252
[2] LC_CTYPE=English_United States.1252
[3] LC_MONETARY=English_United States.1252
[4] LC_NUMERIC=C
[5] LC_TIME=English_United States.1252
attached base packages:
[1] stats graphics grDevices utils datasets methods base
other attached packages:
[1] rj_0.5.2-1 lattice_0.19-17
loaded via a namespace (and not attached):
[1] grid_2.12.1 rJava_0.8-8 tools_2.12.1
On Wed, Jun 22, 2011 at 2:40 PM, Alexander Shenkin <ashenkin at ufl.edu> wrote:
> On 6/22/2011 1:34 PM, Sarah Goslee wrote:
>> On Wed, Jun 22, 2011 at 2:28 PM, David Winsemius <dwinsemius at comcast.net> wrote:
>>>
>>> On Jun 22, 2011, at 2:03 PM, Sarah Goslee wrote:
>>>
>>>> Hi,
>>>>
>>>> On Wed, Jun 22, 2011 at 11:40 AM, Alexander Shenkin <ashenkin at ufl.edu>
>>>> wrote:
>>>>>>
>>>>>> is.na(strptime("5/2/1992", format="%m/%d/%Y"))
>>>>>
>>>>> [1] FALSE
>>>>>>
>>>>>> is.na(strptime("5/3/1992", format="%m/%d/%Y"))
>>>>>
>>>>> [1] TRUE
>>>>
>>>> I can't reproduce your problem on R 2.13.0 on linux:
>>>
>>> I also cannot reproduce it on a Mac with 2.13.0 beta
>>
>> Which strongly suggests that you should start by upgrading your R
>> installation if at all possible.
>>
>> I'd also recommend trying it on a default R session, with no extra
>> packages loaded, and no items in your workspace. It's possible that
>> something else is interfering.
>>
>> On linux, that's achieved by typing R --vanilla at the command line.
>> I'm afraid I don't know how to do it for Windows, but should be
>> similarly straightforward.
>>
> Thanks Sarah. Still getting the problem. I should surely upgrade, but
> still, not a bad idea to get to the bottom of this, or at least have it
> documented as a known issue. BTW, I'm on Windows 7 Pro x64.
>
> (running Rgui.exe --vanilla):
>
>> is.na(strptime("5/3/1992", format="%m/%d/%Y"))
> [1] TRUE
>
>> is.na(strptime("5/2/1992", format="%m/%d/%Y"))
> [1] FALSE
>
>> sessionInfo()
> R version 2.12.1 (2010-12-16)
> Platform: i386-pc-mingw32/i386 (32-bit)
>
> locale:
> [1] LC_COLLATE=English_United States.1252
> [2] LC_CTYPE=English_United States.1252
> [3] LC_MONETARY=English_United States.1252
> [4] LC_NUMERIC=C
> [5] LC_TIME=English_United States.1252
>
> attached base packages:
> [1] stats graphics grDevices utils datasets methods base
>
> ______________________________________________
> 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.
>
--
___________________________
Luke Miller
Postdoctoral Researcher
Marine Science Center
Northeastern University
Nahant, MA
(781) 581-7370 x318
More information about the R-help
mailing list