[R] Is this foreach behaviour correct?

Jim Lemon drjimlemon at gmail.com
Sun Nov 6 23:02:09 CET 2016


hi James,
I think you have to have a starting date ("origin") for as.Date to
convert numbers to dates.

Jim

On Sun, Nov 6, 2016 at 12:10 PM, James Hirschorn
<james.hirschorn at hotmail.com> wrote:
> This seemed odd so I wanted to check:
>
>  > x <- foreach(i=10000:10100, .combine='c') %do% { as.Date(i) }
>
> yields a numeric vector for x:
>
>  > class(x)
> [1] "numeric"
>
> Should it not be a vector of Date?
>
> ______________________________________________
> 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