相当于“抛出”在R [英] Equivalent of "throw" in R
问题描述
我看过恢复
和浏览
和 traceback
但是,他们似乎很接近但不是我正在寻找的。 p>
请参阅 help(tryCatch)
:
'signalCondition
'。另外,
'停止
'和'警告
'功能有
被修改为也可以接受
条件参数。
后面的另请参见:
'
停止
'和'警告
'信号条件'和'try
'本质上是一个
简化版的'tryCatch
'。 p>
所以你可能想要 stop
。
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 function to stop and to stop all functions depending on it.
I have looked at recover
and browse
and traceback
but, well, they seemed to be close but not what I am looking for.
See help(tryCatch)
:
Conditions are signaled by '
signalCondition
'. In addition, the
'stop
' and 'warning
' functions have been modified to also accept
condition arguments.
and later under 'See Also':
'
stop
' and 'warning
' signal conditions, and 'try
' is essentially a simplified version of 'tryCatch
'.
so you probably want stop
.
这篇关于相当于“抛出”在R的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!