Re: [R] select one function from two of them in another function

2009-08-27 Thread Bert Gunter
SH.Chou Cc: r-help@r-project.org Subject: Re: [R] select one function from two of them in another function Is this what you want -- this returns a function that you can then call: test1 <- function() 1 test2 <- function() 2 > test3 <- function(func='test1'){ # return the

Re: [R] select one function from two of them in another function

2009-08-27 Thread jim holtman
Is this what you want -- this returns a function that you can then call: > test1 <- function() 1 > test2 <- function() 2 > test3 <- function(func='test1'){ # return the function to call + if (func == 'test1') return(test1) + return(test2) + } > > # test it > test3()() # default -- notice