This function extracts the body of a function as a single character
.
Usage
function_body(fun, braces = FALSE, nchar = getOption("width") - 4)
See also
Other function helpers:
do.call_timed()
,
function_arguments()
,
function_defaults()
,
quiet()
,
timed()
,
try_silent()
,
variable_name()
Examples
fun <- mean.default
function_body(fun)
#> [1] "if (!is.numeric(x) && !is.complex(x) && !is.logical(x)) { warning(\"argume..."
function_body(fun, braces = TRUE)
#> [1] "{ if (!is.numeric(x) && !is.complex(x) && !is.logical(x)) { warning(\"argu..."
function_body(fun, nchar = 30)
#> [1] "if (!is.numeric(x) && !is.c..."