Learn R Programming

wrapr (version 1.9.6)

bquote_function: Adapt a function to use bquote on its arguments.

Description

bquote_function is for adapting a function defined elsewhere for bquite-enabled argument substitution.

Usage

bquote_function(fn)

Arguments

fn

function to adapt, must have non-empty formals().

Value

new function.

See Also

bquote_call_args

Examples

Run this code
# NOT RUN {


# angle = 1:10
# variable <- as.name("angle")
# plotb <- bquote_function(graphics::plot)
# plotb(x = .(variable), y = sin(.(variable)))



f1 <- function(x) { substitute(x) }
f2 <- bquote_function(f1)
arg <- as.name("USER_ARG")
f2(arg)    # returns arg
f2(.(arg)) # returns USER_ARG




# }

Run the code above in your browser using DataLab