Try this:

test1 <- function()cat("Call: Test 1", "\n")
test2 <- function()cat("Call: Test 2", "\n")

test3 <- function(FUN)
        match.fun(FUN)

test3("test1")

On Thu, Aug 27, 2009 at 5:39 PM, SH.Chou <cls3...@gmail.com> wrote:

> Hi all,      I have two functions called test1() and test2(). Now how do I
> select one of them in test3()??
>
> Say
>  test3<-function(func="test1"){
>        if (func=="test1"){
>               now.func<-test1()
>       }
>       else now.func<-test2()
>  }
>
> I know this function I wrote does not right. Do anyone can tell me how to
> do
> that for real?
>
> Thanks a million
>
> S.H.
>
> --
> =====================================
> Shih-Hsiung, Chou
> Department of Industrial Manufacturing
> and Systems Engineering
> Kansas State University
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help@r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide
> http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>



-- 
Henrique Dallazuanna
Curitiba-Paraná-Brasil
25° 25' 40" S 49° 16' 22" O

        [[alternative HTML version deleted]]

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to