powered by
Replace quoted targets in the body of a function with quoted replacements.
body_replace(fn_body, target, replacement)
The body of a function (as found via body(fun)).
A quoted expression to replace.
A quoted expression with which the target should be replaced.
A function body with the target replaced anywhere it occurs.
# NOT RUN { fun <- function(x) { x^exp } body_replace(body(fun), quote(exp), quote(!!exp)) # }
Run the code above in your browser using DataLab