Content deleted Content added
m CE |
→Structure of a function: Clarified comments in the example code |
||
Line 271:
The following is an example of creating a function to perform an arithmetic calculation:
<syntaxhighlight lang="r"># The function's input parameters are x and y.
# The function,
f <- function(x, y) {
z <- 3 * x + 4 * y
# An explicit return() statement is optional
return(z)
}
#
f <- function(x, y) 3 * x + 4 * y</syntaxhighlight>
|