Hi. I've already posted this question 2 months ago but as I've got no answer I've decided to try again :-) I'm using R1.3.1 on a x86 machine running Win 2000. My problem: I want to convert a string to a date format using strptime. As I'm from Portugal my locale information is the following:> Sys.getlocale()[1] "LC_COLLATE=Portuguese_Portugal.1252;LC_CTYPE=Portuguese_Portugal.1252;LC_MO NETARY=C;LC_NUMERIC=C;LC_TIME=Portuguese_Portugal.1252" If I do the following everything works fine :> k <- "25-Set-01" > strptime(k,"%d-%b-%y")[1] "2001-09-25" because the month September in Portuguese is named "Setembro" and thus is abbreviated as "set" and not "sep" as in English. However, I'm interested in reading English dates. I was hoping that the following would solve my problem:> Sys.setlocale("LC_TIME", locale="USA")[1] "English_United States.1252" However, I get the following error :> k <- "25-Sep-01" > strptime(k,"%d-%b-%y")[1] "NA" Thank you in advance for any help with this, Luis Torgo -- Luis Torgo FEP/LIACC, University of Porto Phone : (+351) 22 607 88 30 Machine Learning Group Fax : (+351) 22 600 36 54 R. Campo Alegre, 823 email : ltorgo at liacc.up.pt 4150 PORTO - PORTUGAL WWW : http://www.liacc.up.pt/~ltorgo -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
Prof Brian Ripley
2001-Dec-11 11:00 UTC
[R] Locale problems with strptime to convert dates
On Tue, 11 Dec 2001, Luis Torgo wrote:> Hi. I've already posted this question 2 months ago but as I've got no > answer I've decided to try again :-)That's because we have no answer: we can't reproduce it (nor something similar involving a Finnish locale). But on many other machines locale-switching does work correctly: the likely problem is in language-specific Microsoft DLLs. `R is a collaborative project with many contributors.' and patches are likely to be accepted. Remember that R has no staff to offer free advice: it does not even have an active Windows maintainer. -- 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 272860 (secr) Oxford OX1 3TG, UK Fax: +44 1865 272595 -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.- r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html Send "info", "help", or "[un]subscribe" (in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._