custom function in r meaning code example
Example: custom function in r
# create custom function
addition <- function(x) {
y <- x + 1
print(y)
}
z <- 2
addition(z) # call new function on variable, z
> 3 # R returns the new value created by function