Re: [R] Is this foreach behaviour correct?

2016-11-13 Thread Henrik Bengtsson
On Nov 13, 2016 13:54, "Henrik Bengtsson" wrote: > > It looks like a bug. I don't think c.Date() is every called, because: > > > trace(c.Date, tracer = quote(message("c.Date() called"))) > Tracing function "c.Date" in package "base" > [1] "c.Date" > > Tracing works: >

Re: [R] Is this foreach behaviour correct?

2016-11-13 Thread Henrik Bengtsson
It looks like a bug. I don't think c.Date() is every called, because: > trace(c.Date, tracer = quote(message("c.Date() called"))) Tracing function "c.Date" in package "base" [1] "c.Date" Tracing works: > c(as.Date(1L), as.Date(10001L)) Tracing c.Date(as.Date(1L), as.Date(10001L)) on

Re: [R] Is this foreach behaviour correct?

2016-11-12 Thread James Hirschorn
I'm still not clear about whether this is a bug in foreach. Should c.Date be invoked by foreach with .combine='c'? On 11/06/2016 07:02 PM, William Dunlap wrote: Note that in the OP's example c.Date is never invoked. c.Date is called if .combine calls c rather than if .combine is c: >

Re: [R] Is this foreach behaviour correct?

2016-11-09 Thread James Hirschorn
Yes, I should have put > library(foreach) > library(zoo) at the top. On 11/06/2016 05:20 PM, Duncan Murdoch wrote: > On 06/11/2016 5:02 PM, Jim Lemon wrote: >> hi James, >> I think you have to have a starting date ("origin") for as.Date to >> convert numbers to dates. > > That's true with

Re: [R] Is this foreach behaviour correct?

2016-11-06 Thread William Dunlap via R-help
Note that in the OP's example c.Date is never invoked. c.Date is called if .combine calls c rather than if .combine is c: > library(zoo) > trace(c.Date, quote(print(sys.call( Tracing function "c.Date" in package "base" [1] "c.Date" > foreach(i=1:10003, .combine=c) %do% { as.Date(i) } [1]

Re: [R] Is this foreach behaviour correct?

2016-11-06 Thread Duncan Murdoch
On 06/11/2016 5:02 PM, Jim Lemon wrote: hi James, I think you have to have a starting date ("origin") for as.Date to convert numbers to dates. That's true with the function in the base package, but the zoo package also has an as.Date() function, which defaults the origin to "1970-01-01". If

Re: [R] Is this foreach behaviour correct?

2016-11-06 Thread Jim Lemon
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 wrote: > This seemed odd so I wanted to check: > > > x <- foreach(i=1:10100, .combine='c') %do% {