Re: [R] AM/PM strptime %p failing 2.11.0 WinXP
On Mon, 24 May 2010, 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 That was a different issue (missing minutes and seconds) and in any case the underlying code has been replaced in the intevening 3.5 years. 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? We don't have the 'at a minimum' information asked for in the posting guide, but your example works for me on my Windows XP machine. Note that the use of %p differs by language settings (and I have seen reports where that was the issue). I used sessionInfo() R version 2.11.0 (2010-04-22) i386-pc-mingw32 locale: [1] LC_COLLATE=English_United Kingdom.1252 [2] LC_CTYPE=English_United Kingdom.1252 [3] LC_MONETARY=English_United Kingdom.1252 [4] LC_NUMERIC=C [5] LC_TIME=English_United Kingdom.1252 in the Europe/London timezone. Thankyou, Samuel Dennis sjdenn...@gmail.com [[alternative HTML version deleted]] -- Brian D. Ripley, rip...@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, UKFax: +44 1865 272595 sessionInfo() R version 2.11.0 (2010-04-22) i386-pc-mingw32 locale: [1] LC_COLLATE=English_United Kingdom.1252 [2] LC_CTYPE=English_United Kingdom.1252 [3] LC_MONETARY=English_United Kingdom.1252 [4] LC_NUMERIC=C [5] LC_TIME=English_United Kingdom.1252 a __ R-help@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.
Re: [R] AM/PM strptime %p failing 2.11.0 WinXP
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 sjdenn...@gmail.com [[alternative HTML version deleted]] __ R-help@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 __ R-help@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.
[R] AM/PM strptime %p failing 2.11.0 WinXP
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 sjdenn...@gmail.com [[alternative HTML version deleted]] __ R-help@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.