3.2 Install R & R Studio
Here’s where you install R on your personal computer, but you’ll actually be installing two separate programs. The first is the R programming language. The second is a separate program called RStudio, which will be the primary way in which you interact with R in this class, we will say more about this later.
3.2.1 Installing R
Installation will look slightly different depending on the operating system, but the major steps are the same.
- First, navigate to the CRAN Mirrors Site, which lists several locations from which R can be downloaded.
- Find a location near you (or not, this isn’t critical) and click on the link to be brought to the mirror site.
From this point, this will change depending on your operating system.
3.2.1.1 Windows
- Click “Download R for Windows”, then click “base”.
- Finally, Click “Download R X.Y.Z for Windows”, where X, Y, and Z will be numbers. These numbers indicate which version of R you’ll be installing. As of the publishing of this book, R is on version 4.4.0.
- Your computer might prompt for the location on your computer that you would like to save the file. Select a location (reasonable options are your
Downloads
folder or theDesktop
) and select “save”. - When the download completes, find the downloaded file in the File Explorer and double click to run it. This will start the installation process.
- Follow the on screen prompts. For the most part you can click “next” and “install” as appropriate, and you don’t have to worry about changing any installation settings.
- Click “Finish” to complete the installation!
This video shows the installation process for Windows.
3.2.1.2 macOS
- Click “Download R for macOS”
- Click “R-X.Y.Z.pkg”, where X, Y, and Z will be numbers. These numbers indicate which version of R you’ll be installing. As of the publishing of this book, R is on version 4.4.0.
- Your computer might prompt for the location on your computer that you would like to save the file. Select a location and select “save”.
- When the download completes, find the downloaded file in the Finder and double click to run it. This will start the installation process.
- Follow the on screen prompts. For the most part you can click “continue”, “agree”, “install”, as appropriate, and you don’t have to worry about changing any installation settings.
- Click “Close” to complete the installation!
3.2.1.3 Linux
We will not provide details on installing R for Linux, because the process varies depending on your distribution, and because if you’re using Linux, chances are you’re more computer proficient than the average user. Suffice it to say, The first step is:
- Click “Download R for Linux”
And you can probably figure things out from there.
3.2.1.4 Conclusion
You should now have R installed! Technically speaking, nothing further is required to work with R. You can open the RGui, and start coding immediately. However, for this course we will be using RStudio, which is a very popular program with an incredibly rich set of features, which will enhance your R programming experience.
3.2.2 Installing RStudio
- Navigate to the RStudio Download Page, and find the download file that matches your operating system.
- Click the link to download the installer, which starts with “RStudio-” or “rstudio-”.
- Your computer might prompt for the location on your computer that you would like to save the file. Select a location (reasonable options are your
Downloads
folder or theDesktop
) and select “save”. - When the download completes, find the downloaded file and double click to run it. This will start the installation process.
From this point, this will change depending on your operating system.
3.2.2.1 Windows
- Follow the on screen prompts. For the most part you can click “next” and “install” as appropriate, and you don’t have to worry about changing any installation settings.
- You should now be able to open the start menu, open the RStudio folder, and click on the RStudio icon to open RStudio
This video shows the installation process for Windows.
3.2.2.2 macOS
- In the window which opens, drag the RStudio icon into the “Applications” folder. You may need to enter your password (click the “Authenticate” button) in order to do so.
- You should now be able to navigate to the Applications folder in Finder, and click on the RStudio icon to open RStudio.
3.2.2.3 Conclusion
Rstudio also offers a cloud service that allows you to work with R in your browser. We’ll use the desktop version but you can check out the interactive primers on the cloud site.
Any feedback for this section? Click here