Rev 44184 | Blame | Compare with Previous | Last modification | View Log | Download | RSS feed
% File src/library/base/man/body.Rd% Part of the R package, http://www.R-project.org% Copyright 1995-2007 R Core Development Team% Distributed under GPL 2 or later\name{body}\alias{body}\alias{body<-}\title{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, envir = environment(fun)) <- value}\arguments{\item{fun}{a function object, or see \sQuote{Details}.}\item{envir}{environment in which the function should be defined.}\item{value}{an expression or a list of \R expressions.}}\value{\code{body} returns the body of the function specified.The replacement form sets the body of a function to theexpression/list on the right hand side, and (potentially) resets theenvironment of the function.}\details{For the first form, \code{fun} can be a character stringnaming the function to be manipulated, which is searched for from theparent environment.If it is not specified, the function calling \code{body} is used.}\seealso{\code{\link{alist}},\code{\link{args}},\code{\link{function}}.}\examples{body(body)f <- function(x) x^5body(f) <- expression(5^x)## or equivalently body(f) <- list(quote(5^x))f(3) # = 125body(f)}\keyword{programming}