4 Setup: RStudio
Purpose: We’re going to make extensive use of the R programming language; in particular, the Tidyverse packages. This first exercise will guide you through setting up the necessary software.
Reading: (None)
Note: If you’re reading this file in RStudio, you can Shift + Click (CMD + Click) to follow a link.
4.0.1 q1 Install Rstudio
Download RStudio Desktop and install the R programming language. Both are free!
Once installed, you can download the source for this exercise and open open it in RStudio (or you can follow e-rep01-intro-git
and clone the repository). This is an R Markdown
file, which is a combination of human-readable text and machine-readable code. Think of it as a modern take on a lab notebook.
4.0.2 q2 Install packages
Next, run RStudio. When the program opens, you should see a console tab, as in the image below.
Note that RStudio has multiple tabs, including the Console
, Terminal
,
Jobs
, and any files you may have opened. Make sure you are in the Console
tab.
Type the line install.packages("tidyverse")
in your Console
and press Enter.
This will start the installation of the tidyverse
package, which we will use
extensively in this class.
4.0.3 q3 Test your install
Once your installation has finished, return to your console and use the command
library(tidyverse)
. If your installation is complete, this command should
return a list of packages and version numbers, similar to the image below.
If you have any issues with installation, please let me know!
4.0.4 q4 Download extras
We’ll use a number of extras for this class. To that end, please install the following packages. Note that you can install multiple packages with the syntax install.packages(c("curl", "mvtnorm"))
, extending the arguments inside c()
as desired.
broom
curl
fitdistrplus
gapminder
ggrepel
googlesheets4
nycflights13
modelr
mvtnorm
rsample
Rtsne
viridis
4.0.5 q5 Download cheatsheets
The tidyverse
is essentially a language built on top of R. As such, there are
a lot of functions to remember. To that end, RStudio has put together a number
of cheatsheets to reference when
doing data science. Some of the most important ones are:
Later, we will learn special tools for handling other types of data. The following cheatsheets will be useful for those: