[R] Feature request for as.Date() function 20)

Greg Snow Greg.Snow at imail.org
Wed Dec 2 21:34:47 CET 2009


If you specify a format, then you don't get the error, just a missing value.  It is a good practice to always specify the format rather than expecting the computer to always guess correctly or expect the original programmers to have anticipated everything that you may ever try. (the development version of the fortunes package has an entry about this).

-- 
Gregory (Greg) L. Snow Ph.D.
Statistical Data Center
Intermountain Healthcare
greg.snow at imail.org
801.408.8111


> -----Original Message-----
> From: r-help-bounces at r-project.org [mailto:r-help-bounces at r-
> project.org] On Behalf Of nabble.30.miller_2555 at spamgourmet.com
> Sent: Wednesday, November 25, 2009 2:40 PM
> To: r-help at r-project.org
> Cc: r-help
> Subject: Re: [R] Feature request for as.Date() function 20)
> 
> On Wed, Nov 25, 2009 at 2:56 PM, jim holtman - jholtman at gmail.com
> <+nabble+miller_2555+9dc9649aca.jholtman#gmail.com 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.
> 
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-
> guide.html
> and provide commented, minimal, self-contained, reproducible code.




More information about the R-help mailing list