📜  抑制错误 - R 编程语言代码示例

📅  最后修改于: 2022-03-11 14:52:00.541000             🧑  作者: Mango

代码示例1
o <- try(1 + "a")
>  Error in 1 + "a" : non-numeric argument to binary operator
o <- try(1 + "a", silent=TRUE)  # no error printed

o <- tryCatch(1 + "a")
> Error in 1 + "a" : non-numeric argument to binary operator
o <- tryCatch(1 + "a", error=function(e){})