[R] AM/PM strptime %p failing 2.11.0 WinXP

Mario Valle mvalle at cscs.ch
Mon May 24 05:27:16 CEST 2010


I know it is not very useful to you, but on Vista with 2.11.patched it 
works:
 > strptime("5/20/2010 6:45:32 PM", "%m/%d/%Y %I:%M:%S %p")
[1] "2010-05-20 18:45:32"
 > strptime("5/20/2010 6:45:32", "%m/%d/%Y %I:%M:%S")
[1] "2010-05-20 06:45:32"
 >
 > sessionInfo()
R version 2.11.0 Patched (2010-04-26 r51822)
i386-pc-mingw32

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
 >
Maybe you can try to set the LANGUAGE to English.
Good luck!
		mario

On 24-May-10 2:59, Samuel Dennis wrote:
> I am attempting to import dates in the following format to R:
> 5/20/2010 6:45:32 PM
>
> Unfortunately I am unable to get the AM/PM function (%p) to work correctly
> under either 2.11.0 or 2.8.1.
>> strptime("5/20/2010 6:45:32 PM", "%m/%d/%Y %I:%M:%S %p")
> [1] NA
>
> but
>> strptime("5/20/2010 6:45:32", "%m/%d/%Y %I:%M:%S")
> [1] "2010-05-20 06:45:32"
>
> showing that the problem is with %p.
>
> I could only find one previous mention of this issue in the archives (
> http://tolstoy.newcastle.edu.au/R/e2/help/06/11/6272.html) , which provided
> no solution beyond upgrading R (which I have done), and just suggested it
> was a problem with that particular installation of R and Windows.
>
> What could I do to get this function working on my Windows XP machine?
>
> Thankyou,
>
> Samuel Dennis
> sjdennis3 at gmail.com
>
> 	[[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.

-- 
Ing. Mario Valle
Data Analysis and Visualization Group            | 
http://www.cscs.ch/~mvalle
Swiss National Supercomputing Centre (CSCS)      | Tel:  +41 (91) 610.82.60
v. Cantonale Galleria 2, 6928 Manno, Switzerland | Fax:  +41 (91) 610.82.82



More information about the R-help mailing list