[Rd] Month recognition issue
Sebastien Durand
sebastien.durand at UMontreal.CA
Wed Sep 7 23:30:16 CEST 2005
Dear all,
I am running
R : Copyright 2005, The R Foundation for Statistical Computing
Version 2.1.1 (2005-06-20), ISBN 3-900051-07-0
Under Mac os X, a french version!
I am preparing a package and I got the following issue
I am trying to read dates that are written in
english and have them recognized by R using
as.Date function.
I realized strangely that when I type
> month.abb
[1] "Jan" "Feb" "Mar" "Apr" "May" "Jun" "Jul" "Aug" "Sep" "Oct"
[11] "Nov" "Dec"
I get the abbreviated english version of every month
> x <- c("1-jan-1960", "2-feb-1960",
>"31-mar-1960", "30-apr-1960","2-may-1960",
>"31-jun-1960", "30-jul-1960","2-aug-1960",
>"31-sep-1960", "30-oct-1960", "30-nov-1960",
>"30-dec-1960");
> strptime(x, "%d-%b-%Y")
[1] "1960-01-01" NA "1960-03-31" NA
[5] NA NA "1960-07-30" NA
[9] "1960-10-01" "1960-10-30" "1960-11-30" NA
It is only once I have found through trial an
error the french abbreviation, that I got a match
for every month.
> x <- c("1-jan-1960", "2-fév-1960",
>"31-mar-1960", "30-avr-1960","2-mai-1960",
>"31-jui-1960", "30-jul-1960","2-aoû-1960",
>"31-sep-1960", "30-oct-1960", "30-nov-1960",
>"30-déc-1960");
> strptime(x, "%d-%b-%Y")
[1] "1960-01-01" "1960-02-02" "1960-03-31" "1960-04-30"
[5] "1960-05-02" "1960-07-01" "1960-07-30" "1960-08-02"
[9] "1960-10-01" "1960-10-30" "1960-11-30" "1960-12-30"
I got simply two questions:
First, why since R was install on a french system
the month.abb command didn't give me the french
abbreviations.
Secondly, since I am producing a package, I would
like to know how can I tell R to momentairly use
the english abbreviations instead of the french
ones...
Thanks a lot
--
More information about the R-devel
mailing list