[R] Date as numeric
MacQueen, Don
macqueen1 at llnl.gov
Mon Mar 23 16:20:40 CET 2015
No formula behind that:
> as.numeric("2012-11-11 19:05:00 UTC")
[1] NA
Warning message:
NAs introduced by coercion
If a character string is recognizable as a number, you get that number.
For example:
> as.numeric('3')
[1] 3
But your character string isn't recognizable as a number, so you get NA,
meaning a missing value. For another example:
> as.numeric( c('3','a','4') )
[1] 3 NA 4
Warning message:
NAs introduced by coercion
However,
> as.numeric(as.POSIXct("2012-11-11 19:05:00 UTC"))
[1] 1352689500
See
> ?DateTimeClasses
for more information.
-Don
--
Don MacQueen
Lawrence Livermore National Laboratory
7000 East Ave., L-627
Livermore, CA 94550
925-423-1062
On 3/23/15, 7:51 AM, "Eduardo M. A. M.Mendes" <emammendes at gmail.com> wrote:
>Hello
>
>I wonder what the formula behind as.numeric("2012-11-11 19:05:00 UTC²) is.
>
>Many thanks
>
>Ed
>
>______________________________________________
>R-help at r-project.org mailing list -- To UNSUBSCRIBE and more, see
>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