install.packages(c("tidyverse"))
Tech Setup
File Organization
Required: Change the default file download location for your internet browser.
- Generally by default, internet browsers automatically save all files to the
Downloads
folder on your computer. This does not encourage good file organization practices. You need to change this option so that your browser asks you where to save each file before downloading it. - This page has information on how to do this for the most common browsers.
Required: Create a folder for this course on your local harddrive (e.g. Desktop
or Documents
), not necessarily on a Cloud Drive as you may encounter large datasets in this class.
R & RStudio
Follow these instructions to set up the software that we’ll be using throughout the semester.
Even if you’ve already downloaded both R and RStudio, you’ll want to re-download to make sure that you have the most current versions.
Required: Re-install R and RStudio.
FIRST: Download R here.
- In the top section, you will see three links “Download R for …”
- Choose the link that corresponds to your computer system.
SECOND: Download RStudio here.
- Click the button under step 2 to install the version of RStudio recommended for your computer.
- Make sure that you fully install the software (Mac: drag to Applications folder) and eject the temporary drives if you are on a Mac
THIRD: Check that when you go to File > New Project > New Directory, you see “Quarto Website” as an option. If you don’t have this option, you haven’t updated RStudio to a recent enough option.
Required: Install required packages.
- An R package is an extra bit of functionality that will help us in our data analysis efforts in a variety of ways.
- Open RStudio and click inside the Console pane (by default, the bottom left pane). Copy and paste the following command into the Console. You should see the text below appear to the right of the
>
, which is called the R prompt. After you paste, hit Enter.
- You will see a lot of text from status messages appearing in the Console as the packages are being installed. Wait until you see the
>
again. - Enter the command
library(tidyverse)
and hit Enter.
If you see an error message, then there was a problem installing the package. Post the full error message in the#r-troubleshooting
channel in our Slack workspace and - Quit RStudio. You’re done setting up!
Optional: For a refresher on RStudio features, watch this video. It also shows you how to customize the layout and color scheme of RStudio.
Required: Set essential RStudio options.
Go to:
- Windows: Edit > Preferences > General
- Mac: Tools > Global Options… > General
Navigate to the “Workspace” section.
- Restore
.RData
into workspace at startup: Leave this unchecked - Save workspace to
.RData
on exit: Select “Never” - Press “Apply” and then “OK”
If you don’t change these options, RStudio will save all of the objects you ever create in your Global Environment. In practice, this leads to all of the objects, datasets, etc that you have ever worked with at Macalester being loaded in when you start RStudio.
- This can make startup slow.
- It clutters the Global Environment. (e.g., You’re working on something and referring to
diamonds
not knowing that adiamonds
that was used in class last year is already in the Global Environment.)
Git & Github
Before the first day of class, follow these instructions below to set up the collaboration/version control software that we’ll be using throughout the semester.
Required: Create a GitHub account (if you don’t have one already) and get Github Student benefits (steps below).
- If you don’t already have one, please create a (free) Github account/username. Go to https://github.com and register for an account if you don’t have one already.
You’ll need to choose a username at this time. Think carefully about this because you may keep this account for a LONG time. Things to consider when picking a username.
Try to incorporate your name in it.
Reuse usernames from other accounts such as Twitter.
Pick a username you’d be ok sharing with future employers.
Shorter is better.
Make it timeless.
Avoid names with words that have special meaning in programming.
After logging on, go to https://education.github.com/students to sign up for student benefits such as unlimited private repositories through Github Education. If you’ve done this in the past, you may need to request benefits again. This gives us access to tools such as Github Co-Pilot.
Download Github Desktop (https://desktop.github.com/). Follow the instructions to connect to your Github account and install Git, as necessary.
I want to make sure to get ahead of any technology issues (they will happen as they always do), so please email me if you encounter any issues!
Troubleshooting
If you encounter errors in installing packages,
- Look in the error message to see if the issue is with another dependent package Try
install.packages()
that package. - If you are using
install_github()
and get an issue about git credential store, try the following:- Go to Github/settings/tokens. Click “Generate new token.” (classic probably the best)
- Select the appropriate scopes for your use case. For installing packages, the following scopes are usually enough: repo, read:packages
- Click “Generate token.” Copy the token, as you’ll need it soon. Open R and run the following commands to set the new token:
gitcreds::gitcreds_set()
This will prompt you to enter a new credential. Paste your newly generated PAT when prompted. Try Installing the Package Again: Now that your PAT is set, try running:remotes::install_github("")