body {base} | R Documentation |
Get or set the body of a function.
body(fun = sys.function(sys.parent()))
body(fun) <- list
fun |
a function object or a character string naming the function
to be manipulated.
If not specified, the function calling |
list |
a list of R expressions. |
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.
alist
,
args
,
function
.
body(body)
f <- function(x) x^5
body(f) <- expression(5^x)
f(3) # = 125
str(body(f))