Hi John, Here is my code practicing. Please give me some advises. Thank you.
Wu Gong # Extract the function string f.str <- sub("y~","",exprtext) # Get arglist from the text sp1 <- paste("\\",c(getGroupMembers(Arith),"(",")"),sep="") sp2 <- getGroupMembers(Math) sps <- paste(c(sp1,sp2),sep="",collapse="|") agl <- gsub("^[0123456789]+$","",strsplit(f.str,sps)[[1]]) agl.u <- unique(agl[agl != "" & agl != "pi"]) # The command string making the function c.str <- paste("f <- function(",paste(agl.u,sep="",collapse=", "),") ",f.str,sep="") eval(parse(text=c.str)) f ______________________________________________ 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.