Single-line function
Short, single-expression functions.
Syntax
name <- function(x) expression
Description
Curly braces are not needed for single-expression functions; the last expression is returned automatically.
Example
Loading editor…
Expected output
17
When to use?
Short helper functions, with sapply/lapply.