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

From: Ales Ziberna <aleszib_at_gmail.com>
Date: Thu 22 Dec 2005 - 19:25:31 EST


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"))#saves the 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")



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Thu Dec 22 19:35:04 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:41:40 EST