traceback() for interactive and non-interactive R sessions

后端 未结 3 583
萌比男神i
萌比男神i 2020-12-14 01:13

I observed a different between an interactive and non-interaction R session about traceback() which I do not understand. For the code below, it will produce an

3条回答
  •  悲哀的现实
    2020-12-14 01:42

    BenBarnes's answer and dshepherd's comment are life saving. I will add one more parameter to avoid clogging up the screen in case one of the parameters is very big.

    options(error=function(){traceback(2,max.lines=3);if(!interactive())quit("no",status=1,runLast=FALSE)})
    

提交回复
热议问题