R: how to clear all warnings

后端 未结 3 1830
没有蜡笔的小新
没有蜡笔的小新 2021-01-30 10:00

I would like to clear the warnings() list using a command line.

I have tried with no success

> rm(last.warning, envir = baseenv())  
Error in rm(last.         


        
3条回答
  •  被撕碎了的回忆
    2021-01-30 10:47

    I agree, I want to use a try() and gather up just the warnings generated by that try().

    My solution for now is

    assign("last.warning", NULL, envir = baseenv())
        myFit  <- try(...)
        warned <- warnings()
    assign("last.warning", NULL, envir = baseenv())
    

提交回复
热议问题