Function arguments can have default values. A call can omit the argument and use the default.

Program

Play the script to call greet without passing a name.

defaults.R
greet <- function(name = "reader") { paste("Hello", name) }
message <- greet()
cat(message, "\n", sep = "")
default argument `name = "reader"` supplies a value when the caller omits `name`.
function call `greet()` uses the default because no argument is passed.
last expression The function returns the value of its last expression.