Getting Started
Installing R, RStudio, and tidyverse
All of our visualization work will be done in the open source (and free!) programming language R. You will use RStudio as the main program to access R. Think of R as an engine and RStudio as a car dashboard—R handles all the calculations and the actual statistics, while RStudio provides a nice interface for running R code.
Install R
First you need to install R itself (the engine).
Go to the CRAN (Collective R Archive Network) website: https://cran.r-project.org/
Click on “Download R for XXX”, where XXX is either Mac or Windows:
- If you use macOS, scroll down to the first .pkg file in the list of files (as of right now, it’s R-4.2.1.pkg) and download it.
- If you use Windows, click “base” (or click on the bolded “install R for the first time” link) and download it.
- Double click on the downloaded file (check your Downloads folder). Click yes through all the prompts to install like any other program.
If you already have R installed, and want to update it (aim for a 4.x.x version)1
- On Mac, you can simply download and install the newest version of R. When you restart RStudio, it will use the updated version of R.
- On Windows, try using the package installr
- Install and load installr:
install.packages("installr")
andlibrary(installr)
- Call the
updateR()
function. This will start the updating process of your R installation by: “finding the latest R version, downloading it, running the installer, deleting the installation file, copy and updating old packages to the new R installation.”
- Install and load installr:
Install RStudio
Next, you need to install RStudio, the nicer graphical user interface (GUI) for R (the dashboard). Once R and RStudio are both installed, you can ignore R and only use RStudio. RStudio will use R automatically and you won’t ever have to interact with it directly.
Go to the free download location on RStudio’s website: https://www.rstudio.com/products/rstudio/download/#download
Select the installer (from the first table) that corresponds with your computer’s operating system (Windows or macOS).
Double click on the downloaded file (check your Downloads folder). Click yes through all the prompts to install as per usual.
Double click on the RStudio app to run it (check your applications folder or start menu).
If you already have RStudio installed and want to update it
- From within RStudio, go to Help > Check for Updates to install newer version of RStudio.
Install tidyverse
R packages are easy to install with RStudio.
- Select the packages panel (in the lower right quandrant: Files/Plots/Packages/Help), then click on “Install.” (Alternatively, in the menu bar at the top, click “Tools” –> “Install Packages…”)
- Type the name of the package you want (
tidyverse
) to install in the pop-up window, and press Install.2
If you already have tidverse installed and want to update it
- From within RStudio, go to Tools > Check for Package Updates. If updates are available, select All (or just tidyverse), and click Install Updates.
Celebrate
You’re awesome and ready to start!