[R] Feature request for as.Date() function 20)
nabble.30.miller_2555 at spamgourmet.com
nabble.30.miller_2555 at spamgourmet.com
Thu Nov 26 06:08:12 CET 2009
An easy way is just to write your own function that will accept "NA",
convert it to NA and then call as.Date.
R is a functional language, so write some functions. Don't try to
overload existing functions with new options that may break a lot of
existing code. If you have special requirements, then adapt your code
to them. You would probably have to wait around for a long time
before an new option got in, so it is easier to create your own.
On Wed, Nov 25, 2009 at 4:40 PM, <nabble.30.miller_2555 at spamgourmet.com> wrote:
> On Wed, Nov 25, 2009 at 2:56 PM, jim holtman - nabble.30.miller_2555 at spamgourmet.com
> <>
> wrote:
>> Seems to work fine in my testing:
>>
>> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
>> and provide commented, minimal, self-contained, reproducible code.
>>>
>>> Similarly, the following command produces the same error:
>>> as.Date("NA")
>>>
>>> However, as.Date(NA) performs as documented.
>>>
>>> Can we enhance the as.Date() function to convert "NA" strings into NA
>>> value prior to type conversion?
>
> I sincerely appreciate the help, but with all due respect, I have read
> the posting guide and did provide the minimal code necessary to
> reproduce the desired feature. To reiterate, I would like to be able
> to feed the character string "NA" to the as.Date() function to yield
> the same result as `as.Date(NA)`. Please advise if testing the
> following does not yield an error:
>> as.Date("NA");
>
> This may or may not aid the read.csv() error message in my particular
> code (for which a workaround has already been identified).
>
> Thank you.
>
>
--
Jim Holtman
Cincinnati, OH
+1 513 646 9390
What is the problem that you are trying to solve?
More information about the R-help
mailing list