I am trying to write a function myfun
in which one of the variables fun
, say, is itself a function. A simple, but ludicrous, example is:
myfun <- function(fun){
return(fun(1))
}
In line with good practice, I want to insert into myfun
a test of fun
to ensure that fun
is indeed a function.
But I can't find code for any such test. What should I do?
Aucun commentaire:
Enregistrer un commentaire