The Function Keyword
In R, function objects are defined with this syntax:
function(arguments
)body
where
is a
set of symbol names (and, optionally, default values) that will be
defined within the body of the function, and arguments
is an R
expression. Typically, the body is enclosed in curly braces, but it
does not have to be if the body is a single expression. For example,
the following two definitions are equivalent:body
> f <- function(x,y) x+y > f <- function(x,y) {x+y}
Get R in a Nutshell now with the O’Reilly learning platform.
O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.