Equivalent of “throw” in R

后端 未结 5 1147
有刺的猬
有刺的猬 2020-12-07 12:09

How does one \"throw\" an error in R? I have a function that takes a data frame and some column names and does stuff with them. If the columns don\'t exist, I want the fun

5条回答
  •  小蘑菇
    小蘑菇 (楼主)
    2020-12-07 12:22

    Simple example:

    f <- function(a, b){ 
    
        if (a == 0){ 
                stop("error message")
        }
     }
    

提交回复
热议问题