【问题标题】:Try/try catch function in RR中的尝试/尝试捕获函数
【发布时间】:2017-06-07 14:56:03
【问题描述】:

如果 trycatch/try 函数返回错误,我如何使用 R 中的 try/try catch 函数进行下一个循环并执行 sys.sleep 60 秒。任何帮助将不胜感激,谢谢。

【问题讨论】:

    标签: r


    【解决方案1】:

    试试这个:

    for (x in list(1,2,"a",4,5)){
      print(x)
      y <- try( x+1) # maybe you want try(x+1,silent=TRUE)
      if(inherits(y, "try-error")) Sys.sleep(5) 
    }
    

    【讨论】:

    • 非常感谢您的帮助,真的很有帮助:)
    猜你喜欢
    • 1970-01-01
    • 2012-11-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2020-06-19
    • 2017-09-12
    • 1970-01-01
    • 1970-01-01
    相关资源
    最近更新 更多