R: Software makes up extra parenthesis

时间:2017-08-13 13:45:37

标签: arrays r qsub

I have a severe problem with R at the moment - I call R-scripts from a cluster and use PBS-Arrays in order to use them. Hence, I can formulate a parameter "args" that I define when using qsub.

Everything works out fine until the very last line of the script. Here, a result file should be written, the name of the file is then dependent on args to make the array parts differentiable.

I receive the following error message: "saveRDS(Res,paste0("LBFGS_Ob4_Stand_Test",as.numeric(args[2]),"_Broad.rds")))" Execution halted

This makes zero sense! The third parenthesis you see at the end of the code line is not even written in the script... when I arrays of let's say 5 parts, frequently two will randomly finish successfully, while the rest cancels with this message. I have no idea what is going on.

Here is an example code for my R script (massively reduced):

setwd("/someFolder") 
args <- commandArgs(TRUE) # allows the handing over of the array parameter when using qsub
set.seed(as.numeric(args[2])) # usage example for the array parameter (it is always index 2)

Res=matrix(0,1,1) # just as a random example
saveRDS(Res,paste0("LBFGS_Ob4_Stand_Test",as.numeric(args[2]),"_Broad.rds"))

When I define args locally and execute, everything works out fine. This is really infuriating - does anyone have a clue?

Also this is a typical qsub-command I use for the call:

qsub -t 1-5 -l cput=200:00:00 Example.sh

-t defines the array parameter. So here I call the script 5 times and args[2] takes the values from 1 to 5.

0 个答案:

没有答案