How to write functions in R? The shortest version

Lets create a function to add two numbers in R

add <- function(a,b){
               a+b}

Thats it. 🙂

add(1,7)
[1] 8

Leave a comment

Website Built with WordPress.com.

Up ↑