Try using 'get' to return the object specified as a character string:
> f1<-function()1
> f2 <- function()2
> z <- 'f2'
> z
[1] "f2"
> get(z)()
[1] 2
>
On 12/8/06, Katharina Vedovelli <[EMAIL PROTECTED]> wrote:
>
> Hi all!
>
> I have lots of functions called in the following pattern
> 'NameOfFunctionNumber' where the name always stays the same and the number
> varies from 1 to 98.
> Another function which I run in advance returns the number of the function
> which has to be called next.
>
> Now I want to combine 'NameOfFunction' with the 'Number' returned so that
> i
> can call the desired function.
> I do this by:
>
> x<-c("NameOfFunction",Number)
> z<-paste(x,collapse="")
> z
>
> which returns
>
> "NameOfFunctionNumber"
>
> My Problem is that R doesn't recognise this as the name of my function
> because of the " at the beginning and the end.
> Is there a way of getting rid of those? Or does anybody know another way
> of
> solving this problem?
>
> Thanks a lot for your help!
> Cheers,
> Katharina
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> [email protected] 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.
>
--
Jim Holtman
Cincinnati, OH
+1 513 646 9390
What is the problem you are trying to solve?
[[alternative HTML version deleted]]
______________________________________________
[email protected] 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.