I'm trying to pass an expression in a nested series of functions. Here is a simplified example of work that I want to do:
require(shiny)
outterfunc <- function(a,b,expr){
innerfunc <- function(a,b, expr){
shiny::exprToFunction(expr,quoted = F)()
}
return(innerfunc(a = a+1,b= b+1, expr=expr))
}
I expect to get this result when I'm running following commands:
outterfunc(2,5,{a*b})
# 18
which give me error like
# Error in exprToFunction(expr, quoted = F)() : object 'b' not found
I managed to solve issue with using eval(parse(text=paste(...... sequence, but I'm wondering is there any clean way to pass expression between nested functions.
Thank you in advance for reading this.
exprToFunctioncome from? Be sure to include references to all relevant packages.exprToFunction. I was using this so widely that I forgot it is not the base function :)