Re: [R] Force a variable substitution in expression

2009-11-27 Thread Saptarshi Guha
> The substitute() function can do it, but the bquote() function is the most > convenient: > >> foo <- function(s) { > +   bquote(expression({ > +    v <- .(s) > +    print(v) > +   })) > + } >> foo(10) > expression({ >   v <- 10 >   print(v) > }) > > Duncan Murdoch > Thanks, after sending this em

Re: [R] Force a variable substitution in expression

2009-11-27 Thread Duncan Murdoch
On 27/11/2009 11:04 AM, Saptarshi Guha wrote: Hello, I have a function that creates an expression object with some variables substituted e.g foo <- function(s){ expression({ v <- s print(v) }) } Thus foo returns an expression, however the expression has the symbol 's' contained with