Reputation: 1533
I am inside the R workspace and I use the command source('myscript.r')
to launch a script. But this script crashes somewhere and then R prompts the quit workspace question. Because this is useful for me for debugging purposes I would like to know what is the last command executed which also should be the command that crashes the execution. I have played with the source() arguments but I am not able to display the last command parsed.
Is there also a way to prevent R from quitting after an error?
EDIT: I think the problem is into a function called by myscript.r, so source() doesn't print any command executed in that function.
EDIT2: Here is an example
qair2rh = function(qair, temp, pres){
temp=temp-273.15
pres=pres*0.01
e <- qair * pres / (0.378 * qair + 0.622)
es <- 6.112 * exp((17.67 * temp)/(temp + 243.5))
rh <- e / es
return(rh)
}
qair=10
temp=20
pres=2
rh=qair2rh(qair, temp, pres)
source doesn't print any of the commands executed inside the function.
Upvotes: 0
Views: 116