[R-SIG-Mac] as.Date() does not work with format %B

peter dalgaard pdalgd at gmail.com
Sat Jun 9 15:01:40 CEST 2012

On Jun 9, 2012, at 13:54 , R. Michael Weylandt wrote:

>> as.Date(strftime(paste("1998",1:12,"09", sep = "-"), "%d %B %Y"), "%d %B %Y")
> [1] "1998-01-09" "1998-02-09" "1998-03-09" "1998-04-09" "1998-05-09"
> [6] "1998-06-09" NA           "1998-08-09" "1998-09-09" "1998-10-09"
> [11] "1998-11-09" "1998-12-09"

Looks like this is 


which was fixed in May 2010, but apparently hasn't percolated down to the OSX updates yet. 
(Still there in local build on Lion, so not just CRAN binaries. Insert appropriate rant about Open Source and commercial vendors here...)

Summary of bug: strptime with %B goes through the months and checks for full name, then abbreviation. Problem is that "jui" of "juillet" matches abbr. for "juin"! but  "llet" mismatches %Y and we get the NA.

Peter Dalgaard, Professor,
Center for Statistics, Copenhagen Business School
Solbjerg Plads 3, 2000 Frederiksberg, Denmark
Phone: (+45)38153501
Email: pd.mes at cbs.dk  Priv: PDalgd at gmail.com

More information about the R-SIG-Mac mailing list