lapplyExec,CommandR-method | R Documentation |
lapply for CommandR
objects using lexec,CommandR-method
## S4 method for signature 'CommandR' lapplyExec(object, X, FUN, env = new.env(parent = emptyenv()), loadPackages = .packages(), Rexec = "Rscript", name = "run", cleanUp = TRUE, ...)
object |
|
X |
the object to iterate over. Currently only |
FUN |
the R function to be run |
env |
R environment or list storing variables that will be exported and might be used in the function call.
Alternatively, it can be a filename of an existing file in which such an environment has been saved using |
loadPackages |
character vector of packages to load before executing the function |
Rexec |
the command that is used to run the R script that is generated |
name |
a name for the execution that will be used as identifier and prefix for the jobs that are run |
cleanUp |
should the directory structure created for running the jobs be deleted when completed |
... |
optional arguments to |
It will create an R script for the commands
a list containing the results of FUN
for each element in X
Fabian Mueller
ll <- lapply(1:20, identity) cmdr <- CommandRsystem("partest") rr <- lapplyExec(cmdr, ll, function(i, b){Sys.sleep(1); print(a); print(b); return(paste("success on job", i, "- status:", b))}, env=list(a="success"), Rexec="muRscript", cleanUp=FALSE, b="superduper") cmdrs <- CommandRslurm("partest", req=c("--partition"="sfgf", "--mem"="4G", "--time"="00:00:10"), user="muellerf") rr2 <- lapplyExec(cmdrs, ll, function(i, b){Sys.sleep(1); print(a); print(b); return(paste("success on job", i, "- status:", b))}, env=list(a="success"), Rexec="muRscript", cleanUp=FALSE, b="superduper")
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.