version$major[1] "4"
version$minor[1] "4.2"
Verify Your Environment + Meet Your Tools
You’re coming into this course with R, RStudio, and Git already installed. This homework is not an in-depth installation guide but rather a verification and orientation. If you need help with installing from scratch please reach out.
By the end of this document you will have confirmed your environment meets course requirements, installed the packages we’ll use this semester, organized your file system the way we’ll work all term, and connected local Git to your GitHub account.
If you hit a snag at any step, the troubleshooting appendix at the bottom of this page covers the most common issues. If that doesn’t resolve it, reach out before the next class.
Open RStudio and run the following in the Console:
You need R ≥ 4.0. If you’re below that, update R from cran.r-project.org before continuing.
To check your RStudio version: RStudio → Help → About RStudio. You need RStudio ≥ 2026.x. Update from posit.co/download/rstudio-desktop if needed.
R is the language and computation engine. RStudio is the interface. Both need to be current — updating one does not update the other.
R’s power comes from packages — collections of functions written and shared by the community. We’ll add packages throughout the semester, but this core set covers the first half of the course.
Run the following in your Console. This will take a few minutes the first time:
install.packages(c(
"tidyverse", # data manipulation and visualization
"tidymodels", # machine learning
"sf", # vector spatial data
"terra", # raster spatial data
"here", # robust file paths
"remotes", # install packages from GitHub
"usethis", # project and git workflow utilities
"gitcreds" # secure credential storage
))Once installed, verify everything loaded correctly:
All values should return TRUE. If any return FALSE, re-run install.packages() for just that package.
Run all four lines below in the Console. This is your environment check — it confirms your username, R version, RStudio version, and that the key packages are installed:
Expected output looks something like:
[1] "mikejohnson"
[1] "4"
[1] '2026.1.0.392'
[1] TRUE TRUE TRUE TRUE
Take a screenshot of this output — it’s part of your submission.
We’ll use a consistent project structure all semester. Set it up now so it’s ready when the labs start.
Open the Terminal tab in RStudio (next to the Console tab) and run:
You should see github in the output. This folder is where every Git-enabled project will live — course labs, your own projects, anything you clone from GitHub.
When you clone a repository it creates a folder on your machine. Keeping everything under ~/github/ means you always know where your projects are and paths stay predictable across your machine. It’s a small habit that prevents a lot of confusion later.
Git needs to know who you are before it can track your work. This is a one-time setup per machine.
First, check whether you’re already configured — run this in the Terminal tab:
If you see user.name and user.email in the output, you’re set. If not, run the following with your info:
Quick check: make sure Git is installed and on your PATH before running the config commands:
If these commands fail, follow the troubleshooting notes below for platform-specific instructions.
Use the same email as your GitHub account — this is how commits get linked to your profile.
Git runs on your machine and tracks changes to files.
GitHub is a cloud platform that hosts Git repositories — backup, sharing, and collaboration.
You need both. They communicate, but they are separate tools.
If you don’t yet have a GitHub account, create one at github.com. Choose your username carefully — it will appear on every project you publish and will become a professional portfolio over time.
Once you have an account:
mikejohnson51/csu-523c-2026 and star the repository — this bookmarks it for you and helps me find your accountGit is configured locally but doesn’t yet know how to authenticate with GitHub. This step creates that connection using a Personal Access Token (PAT) — a secure credential that lets your local Git push and pull without entering a password every time.
In the RStudio Console, run:
This opens GitHub in your browser with the recommended token settings pre-filled.
csu-523c-laptopNote: choose appropriate token scopes (at minimum repo and workflow; add gist if you need gists). Set a reasonable expiration and revoke the token if compromised.
Copy the token immediately — GitHub shows it only once. If you close the page without copying it, you’ll need to generate a new one.
Back in the RStudio Console, run:
When prompted, paste your token. You’ll see a confirmation that credentials were set.
Look for these lines in the output:
Git config (global)
• Name: 'Your Name'
• Email: 'your@email.com'
GitHub
• Default GitHub host: 'https://github.com'
• Personal access token for 'https://github.com': '<discovered>'
• GitHub user: 'yourusername'
• Token scopes: 'gist, repo, user, workflow'
If the token line shows <unset> instead of <discovered>, re-run gitcreds::gitcreds_set() and paste the token again.
Submit the following on Canvas:
1. Screenshot of your Console output from Step 3 — showing your username, R version, RStudio version, and four TRUE values.
2. Screenshot of your Terminal output from Step 5 — showing git config --list --global with your user.name and user.email.
3. Your GitHub profile URL — e.g. https://github.com/yourusername
When we visit your profile we should see: a completed profile, the course repository starred, and your user.name email matching what’s in your git config.
Screenshot tips:
Cmd+Shift+4 and drag to select areaWin+Shift+S to use the Snip & Sketch toolPrtSc or your desktop environment’s screenshot toolPreferred workflow (concise): students create their own GitHub repository, configure Quarto to render into a docs/ folder, push main, enable Pages, and submit the Pages URL. This keeps the course repo untouched and makes grading easy.
Quick steps:
csu-523c) and clone it into ~/github/._quarto.yml with website: output-dir: docs (example below). This makes quarto render write into docs/ automatically.quarto.yml (minimal):
main:https://YOURUSERNAME.github.io/YOURREPO/lab-01.html) to Canvas.Package installation fails
Install the failing package individually: install.packages("packagename"). Read the error — it usually identifies the problem. Common causes: outdated R, missing system dependency (Linux), or a network issue.
RStudio.Version() returns an error
This function only works inside RStudio, not in a plain R terminal. Make sure you’re in the RStudio Console pane, not the Terminal tab.
which git / where git returns nothing
Git is not installed or not on your PATH. On macOS run xcode-select --install in the Terminal. On Windows install Git for Windows and restart RStudio.
Terminal tab not visible in RStudio
Go to Tools → Terminal → New Terminal, or use Shift + Alt + R.
Windows: bash commands not working in the terminal
RStudio on Windows defaults to PowerShell. To use bash commands (ls, touch, etc.), go to Tools → Global Options → Terminal and switch the shell to Git Bash.
git config --list --global shows nothing
You haven’t run the config commands yet, or ran them in the Console instead of the Terminal. Switch to the Terminal tab and re-run git config --global user.name and git config --global user.email.
usethis::git_sitrep() shows token as <unset>
The PAT wasn’t stored correctly. Re-run gitcreds::gitcreds_set() and paste the token again. If it’s expired, generate a new one with usethis::create_github_token().
git clone prompts for username and password
Your PAT isn’t being picked up. Run gitcreds::gitcreds_set() again — paste the token (not your GitHub password) when prompted.