Files Corresponding to Short Course Programming in R
This course introduces common programming techniques that can improve the efficiency of your R programs. These techniques include the use of loops and vectorized functions to avoid repeated sections of code. To really take R programs to the next level, we’ll see how to write custom functions that will help to streamline code.
R is an extremely versatile programming language that has the capability to fit a fantastic array of statistical and machine learning models, is extremely easy to collaborate with, and has the capacity to easily and widely share your analyses.
Often times, the same types of steps are taken repeatedly to each column, object, or dataset. Rather than copying and pasting the same code over and over and simply making small tweaks, which is error prone, participants will learn how to automate these changes.
Specifically, we’ll use loops to iteratively reevaluate code while changing elements and then see the efficiency of using vectorized functions to do similar evaluations.
We’ll also discuss the idea of breaking up common tasks into custom functions to help write clean code that is easy to debug. Being able to write your own R functions really opens up the possibilities that R has and can help with general understanding of how R works.
The course provides a brief overview of R data structures followed by the following topics:
Loops in R
Vectorized functions (apply family of functions)
How R functions work
Function writing
This course will make heavy use of hands-on programming. We’ll generally introduce a topic and then have exercises to practice and explore. As such, participants must bring their own laptop computer that has access to the internet and the ability to install programs and download files. This course assumes basic knowledge of how to program in R. Participants taking the course “Basics of R for Data Science and Statistics” should be prepared for this course.