Examples for 'base::function'


Function Definition

Aliases: function return closure

Keywords: programming

### ** Examples

norm <- function(x) sqrt(x%*%x)
norm(1:4)
         [,1]
[1,] 5.477226
## An anonymous function:
(function(x, y){ z <- x^2 + y^2; x+y+z })(0:7, 1)
[1]  2  4  8 14 22 32 44 58

[Package base version 4.2.3 Index]