[R] Problems with passing ... to a function

Ales Ziberna aleszib at gmail.com
Thu Dec 22 11:26:49 CET 2005


Thanks to the helpful R-hlep-er, the problem has been solved.
'm' was matching 'maxiter'.

Thanks again,
Ales Ziberna

----- Original Message ----- 
From: "Ales Ziberna" <aleszib at gmail.com>
To: "R-help" <r-help at stat.math.ethz.ch>
Sent: Thursday, December 22, 2005 9:25 AM
Subject: Problems with passing ... to a function


Dear useRs!



I have written a function that should pass argument "m" to the next
function, however it does not! Please have a look at the function below that
shows a problem and tell me what I am missing. As you can see, the "blocks"
argument is passed corectly, while "m" is not.



Best,

Ales Ziberna





 opt.par.new<-function(
 #function for optimizig partition in blockmodeling
 M, #matrix
 clu, #initial partition
 maxiter=50, #maximum number of iterations
 trace.iter=FALSE, #save a result of each iteration or only the best
(minimal error)
 switch.names=is.null(BLOCKS), #should partitions that only differ in group
names be considert equal (is c(1,1,2)==c(2,2,1))
 save.initial.param=TRUE, #should the initial parameters be saved
 approach,
 ... #other arguments to called functions - to 'crit.fun'
){

 if(save.initial.param)initial.param<-tryCatch(lapply(as.list(sys.frame(sys.nframe())),eval),error=function(...)return("error"))#savesthe inital parameters f<-function(blocks,...)(print(blocks)) f(...)f<-function(m,...)(print(m))f(...)}opt.par.new(M=M,m=1,clu=rep(1:2,times=c(7,8)),blocks=c("null","reg"),approach="val")




More information about the R-help mailing list