[R] as.date - german date format
therneau at mayo.edu
Thu Jan 10 14:20:58 CET 2008
>> Konga wrote:
>>> I have a data.frame with the following variable:
>>> $ xx :Factor w/ 66 levels "01.02.2006","01.03.2006",..: 3 3 3 3 3 3 3 3
>>> now I?d like use "as.date" on it - if I comprehend the instructions on
>>> it should work like this:
>>> as.date(xx, "%d.%m.%Y") - but it doesn?t...
>> What is the error message?
>> - Fehler in as.date(mydata$xx, "%d.%m.%Y") :
>> Cannot coerce to date format
You are invoking a function from the "date" library, but reading
the documentation for "Date"; they are quite different.
The 'date' library was written 8-10 years ago, and is used by some of the
functions in the survival library (a dependence that I am currently removing).
It works quite well, but has a much smaller scope of functionality than the
later 'Date' library, in particular there are no attempts at multi-language
support. So as.date + German format is nearly a contradiction.
function (x, order = "mdy", ...)
So you see that the function does not even have a "format" argument. If your
delimiter were one of /,- then order='dmy' would have worked, but as.date does
not accept '.'
More information about the R-help