How to install R
You can download R using the instructions below.
For Windows
- Go to this R download link for Windows.
- Click the download link for the latest version of R at the top of the page in the gray box. It will say something like "Download R-4.2.1 for Windows" and look like this:
- Run the downloaded file and follow its instructions.
For Macs
- Go to this R download link for Macs.
- Click the download link for the latest version of R under "latest release." It will say something like "R-4.2.1.pkg" and look like this:
- Run the downloaded file and follow its instructions.
FAQs
What is R?
R is a programming language.
Like any language, you can technically write R anywhere -- in an email, in a text, or even on a piece of paper with a pen. However, R was specifically invented so that we can write instructions on our computers to get them to do tasks for us. These instructions are called "code".
Before you can run R code on your computer, you'll need to download R so that your computer can understand this language. This is similar to the way you might download an additional language on your computer so that spellcheck will be able to identify misspelled words.
Where are we installing R from?
We are downloading R from a website associated with R's official website. This website is known as a "CRAN mirror." See "What is CRAN?" below for more information.
What is CRAN?
CRAN stands for "Comprehensive R Archive Network".
R is downloaded from websites called "CRAN mirrors." These "mirror" websites are copies of a master website that contains the latest version of R. CRAN refers to the entire group of mirror sites with copies of R.
Dividing the distribution of R between these mirror sites helps reduce the load of traffic on any one site, improves access speed for the person downloading, and provides alternative options for downloading in case any one site goes down.
What if the download links don't work?
You can download R from R's official website using these instructions:
- Go to R's official website.
- Click on the "download R" link. It looks like this:
- Find a link that seems closest to your location (it does not have to be precise) and click on it. The list of links will look like this:
- Follow steps 2-3 from above for your operating system.
How do I check what version of R I have installed?
You can check what version of R you have installed either from RStudio or from the R console.
Method 1: Check your version of R using RStudio.
- Open RStudio.
- Type "R.version.string" at the bottom, after the ">" symbol.
- Press enter and the output will be your R version information.
Method 2: Check your version of R using the R Console.
- Open "R" on your computer. This will open the R Console. It will look like this:
- Type "R.version" at the bottom of the screen, after the ">" symbol.
- Press enter and the output will be your R version information. It will look like this:
What if I already have R installed? How do I update it?
For Windows
The best practice is to uninstall your current version of R before installing the new version. The easiest way to do this is to use the installr package in RStudio using the following instructions:
- Open RStudio.
- Install and run the installr package using the following code:
install.packages('installr')
library(installr)
updateR()
For more information, see this installr tutorial.
For Macs
You should be able to download the latest version of R (using the instructions at the top of this page) and it will automatically write over the existing version. Please note, you will likely have to re-install any packages you were using (with the install.packages
function).
What if I still have an issue installing R?
If you are in a course or research group that uses R, the fastest way is to get help is to ask instructors, TAs, or classmates for help.
If you are not able to do so, consider these resources:
- searching Stack Overflow for someone with a similar issue or posting an issue yourself
- R's official FAQ for Macs or R's official FAQ for Windows
- searching RStudio's official community for someone with a similar issue or posting an issue yourself