【发布时间】:2017-10-26 13:16:29
【问题描述】:
背景
我有一个名为TBT 的简单函数。该函数有一个名为x 的参数。用户可以为参数x提供R中存在的任何类型rdistribution_name()(例如rnorm()、rf()、rt()、rbinom()等),除了一个:“ rcauchy()"。
问题
我想知道 R 是如何识别用户提供了 rcauchy() 作为 x 的输入的,在这种情况下,R 会发出警告消息?
这是我没有成功的 R 代码:
TBT = function(x) {
if( x == rcauchy(...) ) { warning("\n\tThis type of distribution is not supported.") }
}
TBT( x = rcauchy(1e4) )
Error in TBT(rcauchy(10000)) : '...' used in an incorrect context
【问题讨论】:
-
你试过了吗:
gauchy.test():rdocumentation.org/packages/goft/versions/1.3.1/topics/…?