[R] command history in slave mode

Jannis bt_jannis at yahoo.de
Wed Feb 16 21:08:11 CET 2011


Dear list,


I am running R in slave mode to run some calculations on a remote cluster and would like to somehow retrieve the last command in the case that it causes an error. When an error occours, my job is just quitted and it takes me a lot of work to find out which command in my rather lengthy scripts caused the problem. With the following I manage to save the workspace in case of an error:

save.ws.error = function()
{
        last.error <- paste('Last error: ',geterrmessage(),sep='')
        save.image(file='filename.RData')
}
options(error=quote({save.ws.error()})) 

I would like to include

history() or savehistory() in this call to get the command that caused the error but when I run my script with:

R --slave < scriptname.R  > text_output.out

i get the error message that there is no command history available.

Is there any way to achieve this? 


Cheers
Jannis





More information about the R-help mailing list