[R] Passing command line arguments using parallel package

Bokk, Gene gene.bokk at citi.com
Fri Mar 8 18:51:55 CET 2013


Hello,

I was wondering if there is a way to pass a custom command line argument to slave processes using the parallel package. I need to do this because I have some logic in my .Rprofile that checks what arguments it was called with using commandArgs() and performs certain actions only if it was given a particular argument. I am running the following code on a Windows PC to start slave processes:

require(parallel)
cl <- makeCluster(8)
parLapply(cl, mylist, myfunction)

This seems to create R processes with the following arguments: 

Rterm.exe --slave --no-restore -e parallel:::.slaveRSOCK() --args MASTER=localhost PORT=10187 OUT=/dev/null TIMEOUT=2592000 METHODS=TRUE XDR=TRUE

I would like to be able to add something like --myargument or MYARGUMENT=TRUE when the master process was started with the same argument.

Thank you,
Gene Bokk



More information about the R-help mailing list