The Function Keyword

In R, function objects are defined with this syntax:

function(arguments) body

where arguments is a set of symbol names (and, optionally, default values) that will be defined within the body of the function, and body 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:

f <- function(x,y) x + y
f <- function(x,y) {x + y}