Hi R users: I try this code, where "fun" is a parameter of a random generating function name, and I pretend to use "..." parameter to pass the parameters of different random generating functions.
What am I doing wrong? f1<-function(nsim=20,n=10,fun=rnorm,...){ vp<-replicate(nsim,t.test(fun(n,...),fun(n,...))$p.value) return(vp) } This works! f1() f1(n=20,mean=10) This two fails: f1(n=10,fun=rexp) f1(n=10,fun=rbeta,shape1=1,shape2=2) Thank you for your help. Kenneth [[alternative HTML version deleted]] ______________________________________________ R-help@r-project.org mailing list https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide http://www.R-project.org/posting-guide.html and provide commented, minimal, self-contained, reproducible code.