Installing R & RStudio
Overview
For this course, we will use the R
programming language and the RStudio
IDE for manipulating data and creating data visualizations.
To Do
Tasks
The first step is to install these pieces of software so that you can use them.
- Download and Install R
- Download and Install RStudio
- Configure RStudio
Readings
Determine the version of your computer’s operating system
Your version of operating system will dictate which version of R to download and install. Make note of your computer’s operating system.
Windows systemsare easier and Windows 10 and 11 operating systems will both use the same R versions.
Macs are somewhat more complicated. The version depends on your cpu. Here is how you can determine:
There will be two cpu options, Intel 64-bit for macOS 10.13 or Apple silicon arm64 for macOS 11 and higher.
Cloud Options:
If you do not have a laptop (let me know) or do not have 5GB of hard drive space available on your computer, you might consider a cloud version of the software. One is maintained by Posit (formerly RStudio) and the other is maintained by CMC.
1. https://posit.cloud/plans/free (25 free compute hours a month – make time out)
2. Remote Desktop Protocol (No limit on compute hours) (contact me if interested)
Download R
Once you know your processor, navigate to https://cran.r-project.org/ and in the “Download and Install R” section, select your operating system. You can also select from below and follow the indented sections that follow.
***Windows*** users should select the **base** version of R and download version **4.3.1** **(no other version)** to your computer. If this version is not on the main page, go to the \"Other Builds\" section and select \"previous releases\" and download the correct version.
***Mac*** users should download either **R-4.3.1.pkg** or **R-4.3.1-x86_64.pkg** version depending on the cpu noted earlier. **Do not** download any version other than 4.3.1 and please do not update throughout the semester.
Download RStudio
Use the urls below to download RStudio and save it to the same directory location on your computer as you saved R.
Windows 10/11: https://download1.rstudio.org/electron/windows/RStudio-2023.06.2-561.exe
MacOS 10.15+: https://download1.rstudio.org/electron/macos/RStudio-2023.06.2-561.dmg
Linux: go to https://posit.co/download/rstudio-desktop/
Note: If you have a 32bit operating system, you will need to install an older version: https://www.rstudio.com/products/rstudio/older-versions/
Install R and RStudio on your Computer
Install R first and then install RStudio.
Installing should be easy and you can accept all of the defaults although the desktop icons are not needed, especially for R because you will never need it; RStudio will find R for you. You can follow these videos for simple installing.
PC: How to Install R and R Studio on Windows 10/11
Mac: Installing R and RStudio on a Mac
Note: If you leave the desktop icon for R, you can remove that later. You will never need it because RStudio will find R for you.
##Additional Step for Mac Users:
Download and Install XQuartz
Some functions in R require an “X11 Server” and/or libraries associated with an X11 server. Apple does not provide this software with OS X anymore so unfortunately you have to do it on your own via a third-party application called XQuartz for OS X 10.9 or later.
Use the url below to download the XQuartz file and save it to your computer. Follow the same install instructions as above for installing the XQuartz file.
For macOS 10.9 or later, download this XQuartz file and save it to your computer and install: https://github.com/XQuartz/XQuartz/releases/download/XQuartz-2.8.5/XQuartz-2.8.5.pkg
Verify that RStudio is communicating correctly with R
Launch the RStudio application.
If RStudio and R are communicating correctly, you should see an RStudio window open with the R console opened which should look similar to that shown below. Your R version should be listed at the top of the console (4.3.1 Beagle Scouts).
Configure RStudio
A. Go to Tools -> Global Options under the General + Basic Tab
· R Sessions -> R version: There should be a path to the installed R version listed if you installed R before R Studio. You should not need to change this unless you have another version installed on your system. If you do have multiple versions, browse to version 4.3.1. Do not update R or any libraries during this course.
B. Other options: Check the other check boxes as indicated in the images below.