2.3 R and R Studio

2.3.1 R

R is the most influential statistical software that is widely used in data science. The R Project for Statistical Computing. R allows the user to take control of their analyses and being open about how the data were analysed, etc. R encourages transparency and reproducible research.

###Downloading base R

If you are a windows user, download the latest version here R version 4.3.1. If you are a MacX user, download the latest version here R version 4.3.1. Other Linux versions available here.

Using up-to-date versions of R is important as this allows you to use the latest developments of the software. You can have a look at what is new in this latest release here.

###Upgrading your current R installation

You can download the latest version from above and update. Or you can use the package installr and upgrade to the latest available version. If the package is not installed, use this: install.packages("installr") and then run with library(installr) then type installr in the console (what? what’s a console?). We’ll come to this later on!

2.3.2 R Studio

R Studio is one of the mostly used free and open-source integrated development environment for R. It allows the user to have access to various information at the same time, e.g., the Source, the Console, the Environment and the Files, etc. When you open R studio, and if you have installed R appropriately, then R Studio will “talk” to R by sending it messages to execute commands.

You can set up the layout to suit your needs. I always find the following layout best for my needs:

  1. The Source pane: the file where you write your code
  2. The Console where actual code is run
  3. The Environment pane, which shows you all variables/datasets, with the history of executed code, etc.
  4. The Files/Viewer pane, which shows you the files in the current folder, the plots, the installed packages, and help files, etc.

If you click on Tools and Global options, then Pane Layout, you can change the order, and add/remove options from the two panes below. You will see that I use a specific formatting as this suits me best and also have a special colour-coding used (Theme Modern et Editor theme = Tomorrow Night Bright). Use the theme that works best for you!!

2.3.3 Other options?

###Text Editors

I use Sublime Text to run Python, Praat and write in . I use R Markdown in R to publish my code and write notebooks. I am in the process of writing my first article with R Markdown for a fully reproducible research.

There are many development environments that can be used to “talk” to R: TinnR, Visual Studio, etc…

###R GUIs

GUIs (for Graphical User Interface) for R are available. I list below a few. However, after trying some, I found it much easier to get to code directly in R. I don’t remember all codes! I use these to my advantage, by saving my code into a script and using it later on in other scripts.

Some of the GUIs are meant to make R like excel or SPSS, while others are more specialised. Here is a list of some of these GUIs…

  1. RCommander is the first GUI I used (and hated!). It is the one used in Discovering Statistics using R by Andy Field. There are compatibility issues between RCommander and RStudio… Install RCommander using install.packages("Rcmdr"). Then using R base, run RCommander from using library(Rcmdr).
  2. rattle is more of use for data mining and advanced statistics (use library(rattle) then rattle() to run)
  3. Deducer. For basic and advanced statistics (run with library(Deducer) after installation)
  4. RKWard. For basic and advanced statistics. Not available on CRAN and should be downloaded and installed.
  5. Etc..

You can always start by using any of the above to familiarise yourself with the code, and then move to using R fully via code. My recommendation is to start coding first thing and search for help on how to write the specific code you are after.