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"?
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.
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.