Learn R Programming

oeli (version 0.5.2)

function_body: Extract function body

Description

This function extracts the body of a function as a single character.

Usage

function_body(fun, braces = FALSE, nchar = getOption("width") - 4)

Value

A character, the body of f.

Arguments

fun

A function.

braces

Either FALSE (default) to remove "{" and "}" at start and end (if any), or TRUE if not.

nchar

An integer, the maximum number of characters before abbreviation. Must be at least 3. By default, nchar = getOption("width") - 4.

Examples

Run this code
fun <- mean.default
function_body(fun)
function_body(fun, braces = TRUE)
function_body(fun, nchar = 30)

Run the code above in your browser using DataLab