try this: f1 <- function(x) x + 1 f2 <- function(x) x + 2 f3 <- function(x) x + 3
########### FunNam <- "f1" eval(call(FunNam, x = 1:5)) FunNam <- "f2" eval(call(FunNam, x = 1:5)) FunNam <- "f3" eval(call(FunNam, x = 1:5)) I hope it helps. Best, Dimitris ---- Dimitris Rizopoulos Ph.D. Student Biostatistical Centre School of Public Health Catholic University of Leuven Address: Kapucijnenvoer 35, Leuven, Belgium Tel: +32/(0)16/336899 Fax: +32/(0)16/337015 Web: http://med.kuleuven.be/biostat/ http://www.student.kuleuven.be/~m0390867/dimitris.htm ----- Original Message ----- From: "Katharina Vedovelli" <[EMAIL PROTECTED]> To: <[email protected]> Sent: Friday, December 08, 2006 2:57 PM Subject: [R] Remove " from a string > 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. > Disclaimer: http://www.kuleuven.be/cwis/email_disclaimer.htm ______________________________________________ [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.
