Problem set 0 — Setup and workflow check
PS0 is a required hand-in before lecture 2, but it is not graded.
The point is simple:
- get
R, Git, andVS Codeworking on your own computer, - make sure
VS Codecan actually talk toR, - make sure you can receive a GitHub Classroom assignment, edit files, and push changes.
Note that your hand-in of PS0 happens in a GitHub Classroom repository. The invite link is on Athena.
Need help getting your setup working? There will be PS0 office hours on 26/3, 14:00-15:00 on Zoom.
What you need to hand in
Your PS0 GitHub Classroom repository should contain:
- a completed
answers.md, - a
setup_report.txtfile created by runningcheck_setup.R, - at least one commit pushed to GitHub after you edited the files.
The files answers.md and check_setup.R are already included in the starter repository. You just need to clone the repo, update the files, commit, and push.
Completion checklist
Before lecture 2, you should have:
- installed
R, Git, andVS Code, - installed the
VS Code Rextension, - installed the
Rpackageslanguageserverandhttpgd, - created or fixed your GitHub account,
- accepted the
PS0GitHub Classroom assignment, - opened the assignment repo in
VS Code, - ran
Rscript check_setup.R, - edited
answers.md, - committed and pushed your changes.
How to read the commands in this handout
When you see a code block like this:
git statusyou should type that command in a terminal.
On macOS, the built-in Terminal looks roughly like this:
On Windows, use Git Bash rather than PowerShell for these instructions unless you are comfortable translating commands. This is the Git Bash terminal:
Required software
R
Go to CRAN, click Download R for Windows, then install the latest base version of R.
You can open the basic R app once just to confirm that the installation worked.
Homebrew (recommended)
If you do not already have Homebrew, install it first. At the time of writing, that means running:
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"If the installer says Password: or asks for your password, type your normal computer login password and press Enter.
You will not see any characters appear while you type the password. That is normal.
brew install --cask rManual install
Download the latest macOS installer from CRAN.
sudo apt update
sudo apt install r-baseVS Code
Install VS Code from the download page.
By default, VS Code may use PowerShell as the integrated terminal. I recommend switching that to Git Bash:
- open the command palette with
Ctrl+Shift+P, - search for
Terminal: Select Default Profile, - choose
Git Bash.
Homebrew (recommended)
brew install --cask visual-studio-codeManual install
Download VS Code from https://code.visualstudio.com/download.
Follow the official Linux instructions.
Git
Install Git from git-scm.com. Use the default settings unless you know why you want something else.
After install, open Git Bash and run:
git --versionIt should look roughly like this:
Homebrew
brew install gitAlternative
xcode-select --installsudo apt update
sudo apt install gitAfter Git is installed, set your name and email in a terminal:
git config --global user.name "Your Name"
git config --global user.email "your.email@example.com"Use the same email as on your GitHub account if possible.
VS Code and R
Install the VS Code R extension
Install the VS Code R extension.
With VS Code open:
- open Extensions,
- search for
R, - install the extension from
REditorSupport.
Install the required R packages
Open an R terminal in VS Code and run:
- open the command palette with
Ctrl/Cmd+Shift+P, - run
R: Create R Terminal, - then run:
install.packages(c("languageserver", "httpgd"))If R asks you to select a CRAN mirror, type 1 and press Enter to choose 0-Cloud [https], or choose another number for a nearby mirror.
On some computers the mirror-selection window opens behind VS Code, so if nothing seems to happen after you run install.packages(...), check whether a small popup window is waiting for you in the background.
These two packages matter immediately:
languageserverhelpsRtalk toVS Code,httpgdletsVS Codedisplay plots cleanly.
GitHub and GitHub Classroom
Create or fix your GitHub account
If you do not already have a GitHub account, create one at https://github.com/.
GitHub Education is recommended because it gives you free access to some student benefits, including better access to Copilot, but it is not required for completing PS0.
Accept the PS0 assignment
Use the GitHub Classroom link provided in class or on the course page.
Then:
- sign in to GitHub if you are not already signed in,
- if GitHub Classroom asks for permission to access your account, approve it,
- click Accept assignment,
- wait a few seconds while GitHub Classroom creates your personal
PS0repository, - click the link to open that repository on GitHub.
That repository is your PS0 hand-in repo.
Open the assignment repo in VS Code
The simplest route is:
- on the GitHub repository page, click the green Code button,
- make sure HTTPS is selected,
- copy the repository URL,
- in
VS Code, open the command palette withCtrl/Cmd+Shift+P, - run
Git: Clone, - paste the repository URL,
- choose a local folder,
- open the cloned repo in a new
VS Codewindow.
If VS Code or Git asks you to sign in to GitHub during cloning, complete that login flow in your browser and then return to VS Code.
After cloning, the repository should contain at least:
answers.mdcheck_setup.R
If you are on Windows and want to see what the cloning flow looks like, here is a short screen recording: