body                  package:base                  R Documentation

Access to and Manipulation of the Body of a Function

Description:

     Get or set the body of a function.

Usage:

     body(fun = sys.function(sys.parent()))
     body(fun) <- list

Arguments:

     fun: a function object or a character string naming the function
          to be manipulated. If not specified, the function calling
          `body' is used.

    list: a list of R expressions.

Value:

     `body' returns the body of the function specified.

     The assignment form sets the body of a function to the list on the
     right hand side.

See Also:

     `alist', `args', `function'.

Examples:

     body(body)
     f <- function(x) x^5
     body(f) <- expression(5^x)
     f(3) # = 125
     str(body(f))

