Hi,
I wonder how to pass several functions and their arguments as arguments to
a function. For example, the main function is
f = function(X ) {
process1(X)
...
process2(X)
}
I have a few functions that operate on X, e.g. g1(X, par1), g2(X, par2),
g3(X, par3). par1, par2 and par3
On 29/12/2009 3:08 PM, Hao Cen wrote:
Hi,
I wonder how to pass several functions and their arguments as arguments to
a function. For example, the main function is
f = function(X ) {
process1(X)
...
process2(X)
}
I have a few functions that operate on X, e.g. g1(X, par1), g2(X,
Thanks. I don't know how many functions there will be.
What if g1, g2, g3 have variable number of parameters? say g1 has parg1a,
parg1b, and g3 has parg3a, parg3b, parg3c, parg4d.
f - function(X, fs, pars) {
process1(X)
for (i in 1:length(fs))
fs[[i]](pars[[i]]) # doesn't work
On 29/12/2009 5:24 PM, Hao Cen wrote:
Thanks. I don't know how many functions there will be.
What if g1, g2, g3 have variable number of parameters? say g1 has parg1a,
parg1b, and g3 has parg3a, parg3b, parg3c, parg4d.
pars could be a list of lists of parameters instead of a list of
Hi Hao,
Ok.
Sorry for my last post.
bests
milton
On Tue, Dec 29, 2009 at 3:08 PM, Hao Cen h...@andrew.cmu.edu wrote:
Hi,
I wonder how to pass several functions and their arguments as arguments to
a function. For example, the main function is
f = function(X ) {
process1(X)
...
5 matches
Mail list logo