How to change warning setting?

前端 未结 3 1389
醉话见心
醉话见心 2020-12-28 17:25

I am trying to debug a function. I would like to display warnings when they occur but I don\'t understand how to change the warning settings.

3条回答
  •  南方客
    南方客 (楼主)
    2020-12-28 17:51

    It may be useful to specify

    options(warn=2, error=recover)
    

    As mentioned by @plannapus, warn=2 will upgrade warnings to errors; error=recover will drop you into a debug/browser mode at the point where the warning (now upgraded to an error) occurred. (Use options(warn=0, error=NULL) to restore the original settings.)

提交回复
热议问题