On Wed, Feb 8, 2012 at 4:02 PM, moli <nird...@gmail.com> wrote: > I want to evaluate f with the mean=7 > > mean=7 > f <- expression(-(x-mean)^2/2) > then get a new expression: > > -(x-7)^2/2 > How could I do it? Thanks. >
You can leave out the initial as.expression if you don't mind having a call object instead: > as.expression(do.call("substitute", list(f[[1]], list(mean = 7)))) expression(-(x - 7)^2/2) -- Statistics & Software Consulting GKX Group, GKX Associates Inc. tel: 1-877-GKX-GROUP email: ggrothendieck at gmail.com ______________________________________________ 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.