[R-SIG-Mac] as.Date() does not work with format %B
Milan Bouchet-Valat
nalimilan at club.fr
Sat Jun 9 15:21:54 CEST 2012
Le samedi 09 juin 2012 à 15:01 +0200, peter dalgaard a écrit :
> 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
>
> http://lists.freebsd.org/pipermail/freebsd-bugs/2009-December/037796.html
>
> 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.
OK, much thanks for the pointer! As I don't have access to the OS X
machine, I did not play enough with it to discover only July has
problems.
I think I'm going to introduce a workaround for French, if Lion still
has the bug, it's going to be there for ages on other versions.
Thanks again.
More information about the R-SIG-Mac
mailing list