From zhongwent at yahoo.com  Sat Apr  5 00:03:01 2008
From: zhongwent at yahoo.com (ZT2008)
Date: Fri, 4 Apr 2008 15:03:01 -0700 (PDT)
Subject: [Rd] How to create a function calling two functions with unknown
 number of parameters?
Message-ID: <16501233.post@talk.nabble.com>



... can be used to represent unknown number of parameters passed into a
function. 

For example, I write a function g. g calls another function f1. 

For example f1 could be different random number generation function. 

when f1=rnorm(), it has 3 parameters n, mean and standard deviation.

when f1=rexp(), it has 2 parameters n and rate. 

g can be defined as

g <- function(f1, ...) {
	f1(...)
}

My problem is what about g calls two functions with unknown number of
parameters.

In this case one ... doesn't help. 

If I define g as follows:

g <- function(f1, f2, ...) {
	f1(...)+f2(...)
}

It seems ... is only passed to f1, it can't be passed to f2. 

Can anybody help me? Thanks!

-- 
View this message in context: http://www.nabble.com/How-to-create-a-function-calling-two-functions-with-unknown-number-of-parameters--tp16501233p16501233.html
Sent from the R devel mailing list archive at Nabble.com.



[Rd] How to create a function calling two functions with unknown number of parameters?
ZT2008