Functions are the verbs of R. When you do something in R, you do it by running a function. For example,
lm(mpg ~ wt, data = mtcars).
1 + 2.
This last one is an alternative way to call the function
'+'(1, 2). In R, even things that do not look like functions are functions.
But what is a function?
A function is simply a piece of code that is packaged in a way that makes it easy to reuse.
This short tutorial will show you how R functions are packaged and how you can work with R functions. It is a pre-requisite for the next tutorial, which will show you how to write your own R functions. Let’s begin!