Append values to function body

appendToBody(fun, values, after = 1L)

Arguments

fun

function.

values

call. Quoted values (i.e. call) to slot in the function body.

after

integer(1). Where to append in the body. The default of 1 places directly after the opening curly bracket.

Value

function.

See also

Examples

## Add a deprecation call into function body. x <- function() { "hello" } body(x)
#> { #> "hello" #> }
x <- appendToBody(x, quote(.Deprecated("y"))) body(x)
#> { #> .Deprecated("y") #> "hello" #> }