This chapter discusses function writing and navigation with RStudio and gives a short introduction to authoring R packages. Some background on R functions and package structure will be given as well.
Functions are very much at the heart of the R language. As your knowledge and experience with R matures, you'll notice that functions are not only to be called from the command line or script. They can be passed as arguments to other functions. Hadley Wickham's popular
plyr
package, for instance, makes extensive use of this feature. Writing functions is one of the most important things there is to learn about R, so in the following section, we have given a small introduction to R functions and discussed RStudio's supporting features. After that, we continue with a short introduction to package writing.