versions R and RStudio installed? ‣ If not, install /update ‣ R: cran.r-project.org/ (Version 3.6) ‣ RStudio: rstudio.com/products/rstudio/download/#download (Version 1.2.1335 or above) ‣ Or use RStudio Cloud: rstd.io/connect-rscloud
a GitHub username… ‣ Incorporate your actual name ‣ Reuse username from other contexts, e.g., Twitter or Slack. ‣ Pick a username you’ll be comfortable revealing to your future boss. ‣ Shorter is better than longer. ‣ Be as unique as possible in as few characters as possible. ‣ Make it timeless — don’t highlight your current university, employer, or place of residence, e.g. JennyFromTheBlock. ‣ Avoid words laden with special meaning in programming, e.g. NA, NULL, etc. From http://happygitwithr.com/github-acct.html by Jenny Bryan
environment for the R programming language ‣ Git: Version control system ‣ GitHub: Web-based hosting service for version control using Git, with additional features for project organization, collaboration, issue tracking, etc.
right thing and create a repo first. ‣ Step 1: Create a new repo on GitHub ‣ Step 2: Copy the repo URL ‣ Step 3: Clone it using RStudio ‣ Step 4: Make changes locally ‣ Step 5: Introduce yourself to Git ‣ Step 6: Commit and push to GitHub ‣ Step 7: Confirm your changes have propagated to GitHub DEMO 1 YOUR TURN 2
‣ if using RStudio locally: observe the literal creation of a directory on your computer ‣ if using Cloud: observe creation of a new RStudio Cloud project in RStudio Cloud…
user.name = "[YOUR NAME]", user.email = "[YOUR EMAIL]" ) Should match your GitHub email address Use your real name, doesn’t need to match your GitHub username git config !--global user.email "[YOUR EMAIL ADDRESS]" git config !--global user.name "[YOUR NAME]" Alternatively, in the terminal…
over will get old quickly ‣ Quick, short term fix: ‣ Run the following in the Terminal for caching password for 2 hours (60*60*2 = 7200 seconds) git config credential.helper 'cache !--timeout=7200' ‣ Longer term fix: ‣ HTTPS credential caching: happygitwithr.com/credential-caching.html ‣ Setting up SSH keys: happygitwithr.com/ssh-keys.html
on GitHub ‣ Step 2: Copy the repo URL ‣ Step 3: Clone it using RStudio ‣ Step 4: Make changes locally ‣ Step 5: Introduce yourself to Git ‣ Step 6: Commit and push to GitHub ‣ Step 7: Confirm your changes have propagated to GitHub ‣ Step 8 (new!): Make changes to the README by directly editing on GitHub and pull to see the changes reflected in your local project
and now I’m realizing I should have been tracking it with git. ‣ Step 0: Create an RStudio Project from existing directory (if an .Rproj file doesn’t already exist) ‣ Step 1: usethis!::use_git() and follow instructions ‣ Step 2: Create a new repo on GitHub without a README ‣ Step 3: Add remote via on RStudio ‣ Click Add remote and paste the URL, and pick a remote name (origin), then Add. ‣ Back in the New Branch dialog enter master as the branch name and make sure Sync branch with remote is checked, then Create. “Create. ‣ In the next dialog, choose overwrite. For more, see happygitwithr.com/existing-github-last.html DEMO
a copy of someone’s repo, clone it ‣ If you might propose changes to that repo, fork it ‣ Let’s give it a try at github.com/mine-cetinkaya-rundel/errormoji ‣ Fork the repo, then add your emoji error translation ‣ You can do this by directly editing in GitHub or by cloning your fork and editing in RStudio / local text editor ‣ Then submit a pull request ‣ Not feeling inspired: Submit a PR that says so! YOUR TURN
challenges of collaborating on GitHub ‣ A good way of avoiding them (or at least making them less of an annoyance) is to commit and push/pull often ‣ Another tip for dealing with them is to learn to appreciate them as a toll that prevent unwanted changes making their way into your code, analysis, report, etc. 2 YOUR TURN ‣ Now you will cause a merge conflict and we’ll resolve it together! ‣ I will cause a merge conflict and resolve it DEMO 1
for free with GitHub ‣ To set up, go to Settings, and then scroll down to GitHub Pages ‣ Easiest option is to link everything you want exposed from your README ‣ Alternatively you can host files for the web in a docs folder, see more at bookdown.org/yihui/blogdown/ on this github.com/rstudio-education/shiny-wsds18
Markdown file? Use output: github_document in your YAML ‣ Make sure to commit and push all figures you want displayed ‣ Label your R chunks informatively for informatively named figure files ‣ And be careful about changing the label of R chunks that generate plots — figures saved under the old name won’t automatically disappear
‣ Keeping projects on the DL during development ‣ Data privacy — but this may not address this issue ‣ Getting private repos for free ‣ Students, faculty, and educational/research staff via GitHub Education ‣ Find out more at help.github.com/articles/about-github-education-for-educators- and-researchers/ ‣ Apply for free repositories for a GitHub Organization for courses or research/lab groups ‣ Official nonprofit organizations and charities via GitHub for Good: github.com/ nonprofit ‣ Everyone else can pay for some private repos, see github.com/pricing for more info
course LMS! ‣ Each class is an Organization (where you can request unlimited private repositories by showing GitHub that you’re using it for teaching) ‣ One repo per student / per project ‣ GitHub Classroom offers some functionality for repository creation for students ‣ ghclass package allows you to do everything from R! ‣ rundel.github.io/ghclass/articles/ghclass.html