[R] as.Date() function
drj|m|emon @end|ng |rom gm@||@com
Mon Aug 20 01:14:06 CEST 2018
Jose has the correct answer. You probably missed this sentence in the
"Note" section of the help page:
"If the date string does not specify the date completely, the returned
answer may be system-specific."
In your case, the function throws up its hands and returns NA as you
haven't specified a date.
On Mon, Aug 20, 2018 at 7:20 AM, <philipsm using cpanel1.stormweb.net> wrote:
> I am having trouble with what must be a very simple problem. Here is a
> reproducible example:
> st <- c("1961-01","1961-04","1983-02")
> # "1961-01" "1961-04" "1983-02"
> st1 <- as.Date(st, format=("%Y-%m"))
> # NA NA NA
> Why the heck am I getting three NAs instead of three Dates?I have studied
> the R documentation for as.Date() and it has not turned on the light bulb
> for me.
> R-help using r-project.org mailing list -- To UNSUBSCRIBE and more, see
> 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