Functions in RStudio

What is a function? In simple words, a function is a set of instructions that you want to use. A function is a code written to carry out a specific task. For example, you want to know the sum of 1+2+3, instead of using the + sign we can use the sum function to add numbers. For example:

1+2+3

or

sum(1,2,3)

or

sum(1:3)