Hi,
I have imported a time series with dates of the following format:
test = c("11-Feb-01","12-Feb-01","01-Mai-08")
This yields:
> as.Date(test, "%d-%b-%y")
[1] NA NA "2008-05-01"
Since, May was translated it obviously takes locale into account.
According to the docs, the %b should be the abbreviated month name, but I guess there's might be some issue there.
How would I go about fixing this?
I'm running R under Linux t2.6.27-9-generic #1 SMP
Update: Digging a bit deeper i find that the issue is in the LC_TIME definition, where the appropriate abbrivations are of the form:
"jan.","feb.","mars", "apr", "mai", "juni", "juli", "aug.","sep.","okt.","nov.", "des."
while my data contains:
"Jan", "Feb", "Mar", "Apr", "Mai", "Jun", "Jul", "Aug", "Sep", "Okt", "Nov", "Des"
I guess I could consider pre-processing the data, but a smooth way of doing this in R would be most welcome.
This works sort-of, but not so elegant:
> as.Date(gsub("Feb","feb.",test), "%d-%b-%y")
[1] "2001-02-11" "2008-02-12" "2008-05-01"
Thanks!