Collaborative Coding

Charlotte Wickham

July 3 2017

Are you ready to contribute to R?

Yes!

What does a contribution look like?

My first contribution…

http://firstpr.me/#cwickham

https://github.com/hadley/adv-r/pull/27/files

My first package contribution

https://github.com/tidyverse/dplyr/pull/307

My first code contribution

https://github.com/rstudio/rmarkdown/pull/41

Where do packages live?

On CRAN

Static repository of released packages

install.packages("munsell")

https://CRAN.R-project.org/package=munsell

munsell on cran

On github

Web platform for hosting version controlled (git) repositories

devtools::install_github("munsell")

https://github.com/cwickham/munsell

munsell on github

Contribution to R packages hosted on github

Github eases collaboration

But remember:

  • github isn’t just for R packages
  • some packages aren’t hosted on github
  • there are other ways to contribute that aren’t contributing to package code

Where should you start?

  1. Visit a package on github
  2. Open an issue
  3. Make a contribution via a pull request
  4. (+) Host your own package on github and make it easy for people to contribute.

1. Visit a package on github

Keep your eyes open for links to github in talks

Visit repo and look around.

1. Start with the README

1. Look at the code

munsell directory structure

R code is in the R directory (might also be in src, data-raw).

Learn about package structure at http://r-pkgs.had.co.nz/

TOC from advanced R

1. Look at the Community

  • Does the README give guidelines for contributing?
  • Is there a contributor code of conduct?
  • Are there many open issues?
  • Who seems to be responding to the issues?
  • Who has contributed to the package?

2. Open an issue

Use an issue to: file a bug report, suggest a feature or ask about how best to contribute.

  • Join github!
  • For bugs, make sure you include a reproducible example (see reprex package)
  • Recognise the maintainer is just a person: be nice!
  • Be patient…

3. Making a contribution via a pull request

Try starting with documentation (like I did).

  • Low stakes
  • May be able to do entirely in browser on github: Editing files in another user’s repository
  • Look out for docs generated by other files:
    • from roxygen2, edit in .R not .Rd, and re-generate .Rd
    • README.md may be generated by README.Rmd

3. More complicated pull requests

You need to master a few things:

3. Finding things to contribute to

  • Work on issues important to you
  • Try searching github: is:issue is:open label:beginner language:R
  • contributr: A Shiny app for finding beginner GitHub issues to contribute to

4+ Host your own package on github and make it easy for people to contribute

Questions?