R and RStudio Set Up
Welcome to Statistical Computing!
Throughout this course, we will be using a statistical software called R. This will allow us to apply all of the concepts that we learn in class to real data sets. R is a computing language that is used in both academia and in industry, so knowing R is a nice thing to add to your CV as you apply for internships, jobs or graduate school. Don’t worry if you have never done computing before - we are going to learn from the ground up in this course!
Why do we need to learn a computing language at all? In practice, real statistical analysis is performed using some sort of computing language. R, STATA, SAS, Python, MatLab and Excel are just a few examples. We will work with R because it is (1) free, (2) widely-used in industry and academia and (3) highly adaptable to multiple disciplines.
Installing what you need
If you are new to R or RStudio, you have two choices to gain access to the software. Both options are free.
- Option 1: You can download the software you need.
- Option 2: You can access RStudio Cloud online.
We discuss both options and provide you the resources you need to install what you need below. Generally, we recommend Option 1, as this allows you to access R without needing to be online. If your computer has limited space (it takes about 1 GB of memory to download) or you prefer to use the Cloud, you can use Option 2.
Option 1: Downloading R and RStudio onto your computer
To install R and RStudio on your computer, follow the steps below (steps 1–5).
- Install R: go to this
link, and choose the download option for your operating system.
- Windows: Click Download R for Windows, then click the install R for the first time button.
- macOS: Click Download R for macOS. Under Latest release, choose the package corresponding to your macOS version.
- Linux: Click Download R for Linux, then select your distro and follow the installation instructions (you will install via the command line).
- Install RStudio: go to this link or type this into your browser: https://posit.co/download/rstudio-desktop/. Scroll down until you see “2. Install RStudio”. Click the Download and follow the prompts on your computer as it installs.
- Open RStudio (the icon is a white R in a blue circle). You should
see something like the following:
- We’ll get acquainted with RStudio in class. For now, let’s just
check that it works. The panel to the bottom left of the screen is
called the console. Next to the
>
, type16 * 7
and hit Enter (or return on Mac). You should get112
. - Finally, we’ll do one more setup step. In the console, copy and paste the following lines of code, and hit enter.
install.packages("tinytex")
::install_tinytex() tinytex
It may take a few minutes to run. If using macOS, you may need to enter your password in the installation process.
You are now ready for Lab 1!
Option 2: RStudio Cloud
For some folks, your computer may have issues installing R either due to operating system or lack of memory. In that case, another option is to use RStudio Cloud. However, there is a time limit (25 hours of active use) for how long you can use RStudio Cloud for free. After that, there is a small fee ($5 a month).
Step 1
Navigate to RStudioCloud at this link: https://login.rstudio.cloud/login?redirect=%2F
Step 2
You will be prompted to log in. You are welcome to use Google and sign in with your Wake Forest email or to create a separate RStudio Cloud account, as you prefer.
Step 3
After you go through the sign up process, RStudio Cloud should launch. This will likely take 30 - 90 seconds, so be patient!
Step 4
Look at the upper right hand corner and choose “New Project”. Click on “New RStudio Project”. This will likely take 30 - 90 seconds, so be patient!
Step 5
We’ll get acquainted with RStudio in class. For now, let’s just check
that it works. The panel to the bottom left of the screen is called the
console. Next to the >
, type
16 * 7
and hit Enter (or
return on Mac). You should get 112
.
Step 6
Finally, we’ll do one more setup step. In the console, copy and paste the following lines of code, and hit enter.
install.packages("tinytex")
::install_tinytex() tinytex
It may take a few minutes to run. You are now ready for Lab 1!