Thank you very much for your good suggestions. I have chosen to pursue the suggestion by Peter which worked like a dream :) However, my problem is slightly more complicated still. I apologize for not mentioning this in the initial question.
I have to do the evaluation inside a loop, not knowing explicitly which 'u' to replace. This is given by the loop I'm in, say something like: i <- 2; j <- 3 eval(substitute(substitute(call,list(paste("u",i,sep="")=quote(x),paste("u",j,sep="")=1)),list(call=e[[1]]))) But this returns a syntax error. Any further suggestions? Regards, Daniel On 3/27/07, Thomas Lumley <[EMAIL PROTECTED]> wrote: > On Tue, 27 Mar 2007, Peter Dalgaard wrote: > > >The way around this is to add a further layer of substitute() to insert > >the value of e: > > >> eval(substitute(substitute(call,list(u2=quote(x),u3=1)),list(call=e[[1]]))) > > u1 + x + 1 > > Or eval(do.call(substitute, list(e[[1]], list(u2=quote(x),u3=1))) > > -thomas > > -- danielberg.no ______________________________________________ R-help@stat.math.ethz.ch 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.