Hi R-users,
I would like to create an expression without evaluating it. Then paste
that expression to an object. Example:
Result <- paste('Result', 1, sep="")
paste(Result, substitute(apply(exp.des[1:10,], 1, one.row,
parms=parameters)), sep="<-")
However this pastes EACH element of the unevaluated expression. Instead
I just would like the expression to be a character string, with just ONE
element.
I tried:
toString(substitute(apply(exp.des[1:10,], 1, one.row,
parms=parameters)))
but it modifies the expression (e.g. removing parenthesis), which I do
not want.
Any idea on how to create an unevaluated expression and paste it to an
object, to get a 1 element output?
Thanks for your help
Lorenzo
[[alternative HTML version deleted]]
On Sun, Oct 17, 2010 at 9:14 PM, Lorenzo Cattarino <l.cattarino at uq.edu.au> wrote:> Hi R-users, > > > > I would like to create an expression without evaluating it. Then paste > that expression to an object. Example: > > > > Result <- paste('Result', 1, sep="") > > paste(Result, substitute(apply(exp.des[1:10,], 1, one.row, > parms=parameters)), sep="<-") > > > > However this pastes EACH element of the unevaluated expression. Instead > I just would like the expression to be a character string, with just ONE > element.Try this: s <- substitute(...whatever...) paste(Result, format(s), sep = "<-") -- Statistics & Software Consulting GKX Group, GKX Associates Inc. tel: 1-877-GKX-GROUP email: ggrothendieck at gmail.com