foo <- function(arg) { substitute(arg) } foo1 <- function(parm) { foo(param) } foo1(2 + 2)
output is:
param
How can I use substitute inside foo such that the output will be the expression 2 + 2?
foo
2 + 2
foo1 <- function(parm) { p <- substitute(parm) do.call(foo, list(p)) } foo1(2 + 2) #2 + 2
2.1m questions
2.1m answers
60 comments
56.8k users