catching an error and then branching logic

后端 未结 2 452
借酒劲吻你
借酒劲吻你 2020-12-02 12:16

How do I write R code that allows me to execute a different path in my code if an error condition happens? I\'m using a function that tends to throw an error. When it meets

2条回答
  •  离开以前
    2020-12-02 12:45

    t <- try(pJohnson(.18, parms))
    if("try-error" %in% class(t)) alternativeFunction()
    

提交回复
热议问题