# The result I am after is the result after a substitution in an expression, such as
substitute(expression(a+b+c), list(a=1)) expression(1 + b + c) # However, the way I want to do it is for a an expression "stored as a variable" as (expr <- expression(a+b+c)) expression(a + b + c) # a) The following does not work (expr2 <- substitute(expr, list(a=1))) expr # b) - whereas this does work: ans <- eval(substitute(substitute(qqq, list(a=1)), list(qqq=expr[[1]]))) as.expression(ans) expression(1 + b + c) # I have - at least - two problems: # I am not sure I understand 1) why a) does not work and 2) why b) does work. # Can anyone point me in the right direction? # Thanks # Søren [[alternative HTML version deleted]]
______________________________________________ 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.