Background
I have a simple function called TBT
. This function has a single argument called x
. A user can provide any type rdistribution_name()
(e.g., rnorm()
, rf()
, rt()
, rbinom()
etc.) existing in R for argument x
, EXCEPT ONE: "rcauchy()
".
Question
I was wondering how R could recognize that the user-provided input for x
belongs to an rcauchy()
family, and when this happens R issues a warning message?
Here is my R code with no success:
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
Aucun commentaire:
Enregistrer un commentaire