Skip to content

function agruments

2 messages · Afshartous, David, Bert Gunter

#
It's trivial -- and many R functions do this. ?outer,?sapply for example.

Once can also return a function. ?approxfun for example

Trivial example that shows how to use ... to pass in extra arguments to fun

chooseFun<-function(dat=1:10,fun=mean,...)fun(dat,...)
chooseFun()
x<-rnorm(100)
chooseFun(x,median)
chooseFun(x,hist)
chooseFun(x,hist,col='gray')

-- Bert Gunter
Genentech Non-Clinical Statistics
South San Francisco, CA
 
"The business of the statistician is to catalyze the scientific learning
process."  - George E. P. Box