Skip to content
Prev 247294 / 398503 Next

question about deparse(substitute(...))

One way is:
   > f <- function(...) lapply(substitute(placeholderFunction(...))[-1],
deparse)
   > f(x, log(y), (function(a){a+a^2/2+a^3/6})(z))
   [[1]]
   [1] "x"

   [[2]]
   [1] "log(y)"

   [[3]]
   [1] "(function(a) {"       
   [2] "    a + a^2/2 + a^3/6"
   [3] "})(z)"                

Use paste(collapse="\n",s) or s[1] on
deparse's output if you require one
string per input.

Bill Dunlap
Spotfire, TIBCO Software
wdunlap tibco.com