1.2 Installing R

The installation process is straight forward. Download R and RStudio (Windows, Linux and Mac OS X), run the files and follow the instructions to install them (install R first and RStudio second). Once both installed, open RStudio, go to File > New File > R Markdown to create a new RMarkdown. There are many other types of files but we will mainly be using RMarkdown in this book. I will give you few minutes to complete these steps. If you get any errors or warnings, please look them up. Looking up errors is 90% of coding especially in the early stages of learning, the percentage starts decreasing as you become more fluent in the coding language. In looking up errors, I mostly find the solution in Stackoverflow.

All done? Perfect! Let’s talk about the R Markdown interface. It is divided into 4 sections: (1) upper left: the editor where you write your code, (2) upper right: the environment history where you will see you variables, and other details about your data and history of your edits, (3) lower left: the console where you see the execution of your code, and (4) lower right: the window that shows your files (databases and code files), the plots you generated, the packages you are using, a Help tab if needed (we will discuss later how to use help), and a Viewer tab. The editor section is the one you will use the most.