fairchoices setup
🧭

Let's set up your computer for fairchoices

About 1 hour Β· mostly waiting for downloads

Answer three quick questions. After that you'll go one step at a time, and every step shows you what to click.

1. Which computer do you have?
2. Which editor do you want to use? You can switch later.
3. Already done any of these? Tick them to skip.
Before you start
πŸ”
Can you install apps?On a university laptop, try Self ServiceSoftware Center first, or ask IT.
πŸ“
Not in OneDriveKeep code out of OneDrive, iCloud and Dropbox. Syncing breaks Git.
πŸ’Ύ
~4 GB free spaceFor R, the editor and packages.

Install Git

10 minutes

Git tracks changes to the code and lets you share your work with the team.

Open TerminalPress Cmd + Space, type Terminal, press Enter.
Paste this, press Enter
Click Install, then AgreeTakes 5–15 min. Not Xcode itself, just its small tools.
Check: type git --versionAny version number means it worked βœ“
Downloadgit-scm.com/downloads/win β†’ Click here to download
Double-click itFind it in Downloads. Click Yes if Windows asks.
On the "editor" screen, pick NotepadVim is hard to use. (VS Code users can pick VS Code.)
Everything else: just click NextThen Install β†’ Finish.
Check it workedStart menu β†’ type Git Bash β†’ open it β†’ type git --version.

Then tell Git your name once

Paste both lines into Put in your name, and the email you'll use for GitHub.
Something went wrong?
"git is not recognized…"
Close all terminal and editor windows and reopen them. Programs only notice newly installed software when they start.
"xcrun: error: invalid active developer path"
This usually happens after a macOS update. Run xcode-select --install again.
Stuck on a weird screen in the terminal
That's the Vim editor. Press Esc, type :q!, press Enter.

Get access on GitHub

5 minutes + waiting for an invite

The fairchoices code is private on GitHub. Do this early, because the invite can take a day.

Make a free accountgithub.com/signup (skip if you have one)
Send your username to a maintainerAsk to be added to BCEPS/fairchoices. Who to ask ↓
Accept the invitationUse the link in the email, or open it here.
Check: you can see the codegithub.com/BCEPS/fairchoices

πŸ‘‹ Who to ask for access

Not in the BCEPS organisation yet, or can't see the code? Send your GitHub username to any of these maintainers:

πŸ™ˆ
Seeing "404 Page not found"? That's normal for a private repo when you're not signed in, or your invite hasn't been accepted yet. If it's been more than a day, ping one of the maintainers above.

Install R

10 minutes

R is the language fairchoices is written in. Install it before the editor. You need version 4.4 or newer.

Check your chipApple menu β†’ About This Mac. "Apple M…" or "Intel"?
Download the matching onecran.r-project.org/bin/macosx: arm64 for M-chips, x86_64 for Intel
Double-click itIt's in your Downloads folder.
Continue β†’ Agree β†’ InstallType your Mac password if asked. Then Close.
Double-click itClick Yes if Windows asks.
Next, Next, Next… FinishThe defaults are fine.
Optional: Rtools, only if R says "Rtools is required"

fairchoices and its dependencies install without it. You'll only need Rtools if R later shows the error Rtools is required to build R packages, e.g. when installing a package that has to be built from source.

Open the one that matches your Rcran.r-project.org/bin/windows/Rtools β†’ then click Rtools45 installer
Double-click β†’ Next β†’ Next β†’ InstallYou never need to open it. R uses it to build some packages.
Already have R? Check your version

Open R or your editor's console and type R.version.string. If it shows 4.4.0 or higher, skip this step.

Install

10 minutes Β·

This is the window you'll work in every day. It's where you read code, run R and save changes.

Double-click the .dmg
Drag Positron into ApplicationsThen open it from Applications.
Double-click it
Next β†’ Install β†’ FinishKeep "Add to PATH" ticked.
Start R: click the button at the top rightChoose R 4.x.x. A console appears at the bottom.
Double-click the .zipIt unpacks into "Visual Studio Code".
Drag it into ApplicationsThen open it.
Double-click it
Next β†’ Install β†’ FinishKeep "Add to PATH" ticked.
Add R: Extensions β†’ search "R" β†’ InstallPick the one by REditorSupport.
Start R+Shift+P β†’ type R: Create R Terminal
Paste this, then restart VS CodeIt turns on autocomplete and help pop-ups.
Double-click the .dmg
Drag RStudio into ApplicationsThen open it.
Double-click β†’ Next β†’ Install β†’ Finish
Turn off saved sessionsTools β†’ Global Options β†’ General: untick "Restore .RData", set "Save workspace" to Never.
Check Git is foundTools β†’ Global Options β†’ Git/SVN. The path should be filled in. Restart RStudio.

πŸ“ This is where you type R code

The R terminalConsoleConsoleWhenever this guide says "R console", it means here. Try typing 1 + 1 and pressing Enter.
Something went wrong?
No R option in the top-right button
Install R first (previous step), then quit and reopen Positron.
VS Code can't find R
Settings (+,) β†’ search r.rpath.windowsr.rpath.mac β†’ enter C:\Program Files\R\R-4.6.2\bin\R.exe/usr/local/bin/R.
The Git path is empty
Click Browse… and pick C:\Program Files\Git\bin\git.exe/usr/bin/git, then restart RStudio.
"App can't be opened because it is from an unidentified developer"
Right-click the app β†’ Open β†’ Open.
πŸ”‘

Connect to GitHub

5 minutes Β· once per computer

You'll make a token, a special password just for this computer, so GitHub lets you download the private code. All of this happens in the R console.

Install two helpers
Ask GitHub for a tokenYour web browser opens.
Name it, then click Generate tokenThe right boxes are already ticked. Scroll down to the button.
Copy the tokenIt starts with ghp_ and is shown only once.
Save it: run this, paste, press Enter
Check: look for "discovered"
🀫
Treat the token like a password. Never paste it into code, chat or email.
Something went wrong?
The browser didn't open
Go to github.com/settings/tokens β†’ Generate new token (classic), and tick repo, workflow and user.
R asks you to "choose a CRAN mirror"
Pick 0-Cloud, or any one near you.
GitHub says "Configure SSO"
On the tokens page, click Configure SSO β†’ Authorize next to BCEPS.
A GitHub sign-in window pops up
That's fine. Choose Sign in with your browser. It does the same job.
⬇️

Download fairchoices

2 minutes Β· you only do this once

This copies the code onto your computer (Git calls this "cloning").

Make a folder called codeIn your home folder (Cmd+Shift+H in Finder)user folder C:\Users\you. Not in OneDrive.
File β†’ New Folder from Git…
Paste the address, pick your code folder
It opens. Click "Yes, I trust"You'll see the fairchoices files on the left.
Source Control β†’ Clone RepositoryThe branch-shaped icon on the left.
Paste the address, pick your code folder
Click Open, then "Yes, I trust"
File β†’ New Project…
Version Control β†’ Git
Paste the address, pick code, Create Project
Check: should say TRUEIf FALSE, reopen the fairchoices folder (double-click fairchoices.Rproj).
Something went wrong?
"Repository not found" or "Authentication failed"
You haven't been added yet (GitHub step), or the token isn't saved (Connect step). Run usethis::git_sitrep() to see which.
Prefer typing? Use the terminal instead
In : cd ~/code then git clone https://github.com/BCEPS/fairchoices.git. Then open that folder in .
No "Version Control" option
RStudio can't find Git. See the Git/SVN picture in the Editor step.
▢️

Install packages and run fairchoices

10–20 minutes the first time

fairchoices uses about 40 other R packages. Install them once, then load your copy of fairchoices.

Install the developer tools
Install everything it needsRed text is normal. If asked about "sources", type no.
Load fairchoicesShortcut: +Shift+LShortcut: +Shift+LOr Command Palette β†’ R: Load All
Check it can reach its dataAnything not βœ” comes with a fix: hint.
Run the testsLook for FAIL 0. Skips are fine.
Try a real analysis
Just want to use fairchoices, not change it?

Skip the Download step. After the Connect step, run install.packages("pak") and then pak::pak("BCEPS/fairchoices"). From then on, use library(fairchoices) in your scripts.

Something went wrong?
"Rtools is required…"
Install Rtools (), restart and try again.
"xcrun: error" / "clang not found"
Run xcode-select --install in Terminal, then try again.
"there is no package called …"
Run the install_deps line again.
"Could not find a root 'DESCRIPTION' file"
R isn't running inside the fairchoices folder. See the check at the end of the Download step.
"Would you like to use a personal library instead?"
Type yes, then yes again.
"API rate limit" / "HTTP 401"
Your token is missing or expired. Redo the Connect step.
βš™οΈ

Extras (only if you need them)

Skip this if nobody has asked you to do it

fairchoices already works with the public data. These are for special cases.

Have a FairChoices API login?Log in once. Run install.packages("keyring") first.
Told to use a different API?Open your private settings file, add the line, save, and restart R.
Given a local data folder?Put this in a .env file and load it with readRenviron(".env"). See EDITING_WORKFLOW.md.
πŸ”’
.Renviron and .env never get uploaded to GitHub. Keep secrets there and nowhere else.
πŸ”

Your everyday routine

Come back to this whenever you make a change
⬇️Pull
β†’
🌱New branch
β†’
✏️Edit
β†’
πŸ§ͺLoad + test
β†’
πŸ’ΎCommit
β†’
⬆️Push
β†’
πŸ™‹Pull request
Get the latest, then make a branch Click the branch name (bottom left) β†’ main β†’ Pull. Then click it again β†’ Create new branch. Git tab β†’ Pull. Then New Branch. Name it like feature/my-change.
Edit files in R/, then reload + testDo this after every save.
Commit, then push Source Control β†’ + on each file β†’ type a message β†’ Commit β†’ Sync / Publish. Git tab β†’ tick Staged β†’ Commit β†’ message β†’ Commit β†’ Push.
Open a pull request on GitHubClick Compare & pull request. Rules: CONTRIBUTING.md
πŸ–±οΈ
Prefer buttons to Git? GitHub Desktop is a free, friendly app for pull, branch, commit and push.