2.1 R and RStudio
First let’s talk terminology. The program RStudio
is called an Integrated Development Environment for the statistical software language R
.
To get both R
and RStudio
requires two separate downloads and files, which can be found here:
R
: https://cran.r-project.org/mirrors.html (you need to select a location to download from; choose any one that is geographically close to you.)RStudio
: https://www.rstudio.com/products/rstudio/download/.
2.1.1 Why do we have two programs?
Think of R
as your basic program - this is the engine that does the computation. RStudio
is a programe where you can see everything you are working on in one place. Figure 2.1 shows an example of an RStudio pane that I have:
There are 4 key panels that I work with, clockwise from the top:
- The source window is in the upper left - notice how those have different tabs associated with them. You can have multiple source files that you can toggle between. For the moment think of these as commands that you will want to send to R.
- The environment and history pane - these tables allow you to see what variables are stored locally in your environment, or the history of commands.
- The files and plots command (a simple plot I was working on is shown currently), but you can toggle between the tabs. The files tab shows the files in the current
Rstudio
project directory. - Finally, the console pane is the place where
R
works and runs commands. You can type in there directly, otherwise we will also just ``send’’ commands from the source down to the console.
Now we are ready to work with R
and RStudio
!