Displaying 2 results from an estimated 2 matches for "dopar2".
Did you mean:
dopar
2011 Jun 28
1
doMC - compiler - concatenate an expression vector into a single expression?
...ctor.
Maybe somebody who knows the internals of these functions could explain
better this behaviour?
How can I concatenate two expressions into a single one?
Thank you,
Renaud
##################################################
# Sample code
##################################################
`%dopar2%` <- function(obj, ex){
# append custom code to the expression
ex <- c(expression({ a <- i; message("Custom ", a);}), substitute(ex))
# call the standard %dopar% operator
do.call(`%dopar%`, list(obj, ex), envir=parent.frame() )
}
res <- foreach(i=1:3) %do...
2011 Jun 29
0
[R-sig-hpc] doMC - compiler - concatenate an expression vector into a single expression?
...gestion works perfectly -- at least with doSEQ, doMC and doMPI.
Bests,
Renaud
On 28/06/2011 15:35, Stephen Weston wrote:
> I think that the result of the concatenation should be a call object,
> rather than an expression object. How about something along the
> lines of:
>
> '%dopar2%'<- function(obj, ex) {
> ex<- as.call(list(as.name('{'),
> quote({ a<- i; message("Custom ", a) }),
> substitute(ex)))
> do.call('%dopar%', list(obj, ex), envir=parent.frame())
> }
>...