Installing R and R Studio
R and the Comprehensive R Archive Network (CRAN)
R is a programming language for statistical computing, but it is useful for a wide variety of applications! It is maintained internationally by a team of developers through the Comprehensive R Archive Network (CRAN). In order to run your R code, you will first need to have R installed!
Install R
R runs on many different operating systems (OS); select the link below that corresponds to your needs.
Select this link to download R for Mac.
Select this link to download R for Windows.
Select this link to download R for Linux.
To install on any of the OS’s, select the Download R for [your operating system] from the links above. Then an installer will guide you through the installation. Linux usually has R already installed, but if you want the most recent or updated version of R, you can download it via the link above.
During the installation process, you will be promoted to select the right time zone and CRAN mirror (web server) in the installation process. Select the mirror that is closest to your location. Here are two options for the UK:
University of Bristol
Imperial College London
Install R Studio
R Studio is a software program that allows you to save your R code and is really helpful! Now, to create, write, and run your R code, you can install the R Studio IDE (integrated development environment) here. After clicking on that link, select Download RStudio Desktop. Then you can download the appropriate version to your OS. This image below shows the steps and webpage on the above link:
Once you have finished the installation, R Studio is ready for action.
In order to run certain types of functions, you might have to install different packages. To install the packages, type install.packages(“packageName”) you can then type library(packageName) to load the package. See the image below for how to install and load packages:
In order to run these, either select the Run button in the top right corner of your IDE, shown below:
The top portion of your screen will be where you can write, comment, and save all your code. The Console will be underneath this, and will display code as it is being run/finished running.
Note: any data objects you have created or imported in R will show under the Environment tab on the right. Now you are ready to start your projects!
Recommended Resources:
R Studio cheatsheets: These are very useful! and include helpful functions and how-to’s depending on your data needs. For working with text the stringR cheatsheet is especially helpful.
Rswirl: interactive learning session for how to use different packages; learn how to use R in R!