Tag Archives: Cours

03Nov/14

French dates in R – From Mac OS to Windows

Station Clock - By derivative work: FischX (talk) Station_Clock.jpg: User:JuergenG, User:AlMare (Station_Clock.jpg) [CC-BY-SA-2.5-2.0-1.0 (http://creativecommons.org/licenses/by-sa/2.5-2.0-1.0) or CC-BY-SA-2.5-2.0-1.0 (http://creativecommons.org/licenses/by-sa/2.5-2.0-1.0)], via Wikimedia Commons
The other day during my R lecture, something I did not expect happen… I should have known, or at least guess that it would not work… But I wanted to believe it would. When I gave examples on how to read both English and French formatted dates in R, what was working perfectly on Mac OS X did not on Windows Seven. The example was the following:

d_char_fr <- "Mer 04 Fév 2015"
d_char <- "Wed 04 Feb 2015"
as.Date(d_char_fr, format = c("%a %d %b %Y"))
as.Date(d_char, format = c("%a %d %b %Y"))