try catch

-bonjour / 2023-05-25 / 原文

点击查看代码
tryCatch(libray(xx),warning = function(w){print("出现警告")},
               error=function(e){print("出现错误")},
               finally={
                 print("导入ggplot2包")
                 library(ggplot2)
               }
)