[R] using list to pass argument to function

TyagiAnupam@aol.com TyagiAnupam at aol.com
Fri Nov 15 02:44:06 CET 2002


A brief follow up on an earlier posting. Thanks for the earlier suggestion.

How does it matter if I pass a list or a vector of 
arguments to a function that is written to take individual arguments:

f3args  <- function(a1, a2, a3) { definition}

f1 <- function(b1, b2) {
calculations
n <- samplesize
b<- someestimate
c<- anotherestimate
d <- c(n, b, c)
h <- sapply(rep(d, R), f3args)
}

e <- c(m, n)

k <- sapply(rep(e, R), f1)

Is there a problem with this. Can one pass a vector of arguments to a 
fucntion that is written for individual arguments. What would be a good way 
for doing this?
--Anupam.
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !)  To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._



More information about the R-help mailing list