Upgrade to Pro — share decks privately, control downloads, hide ads and more …

Anyone Can Play Git/R: Tips for First-Time Contributions to R Packages

Anyone Can Play Git/R: Tips for First-Time Contributions to R Packages

Contributing to R packages and projects can be a rewarding way to give back to the tools you use and to improve your own programming skills in the process. In this talk, Kara will discuss some of the varied ways to contribute to existing projects. Anyone, whether a seasoned programmer or someone brand new to R, can make useful contributions to R packages. Kara will draw on her experience working on ggplot2 to offer strategies for finding your way in an unfamiliar codebase, and to give insights into the relationship between maintainers and contributors.

Kara Woo

June 02, 2018
Tweet

More Decks by Kara Woo

Other Decks in Technology

Transcript

  1. ANYONE CAN PLAY GIT/R
    KARA WOO | @KARA_WOO
    RESEARCH SCIENTIST, SAGE BIONETWORKS
    CASCADIA R CONFERENCE
    Tips for First-Time Contributions
    to R Packages

    View Slide

  2. Photo: Asa Rodger
    THE STRUGGLE IS REAL

    View Slide

  3. Photo: Elaine Casap

    View Slide

  4. Photo: Asa Rodger

    View Slide

  5. Photo: Andrew Seaman

    View Slide

  6. diverse fields

    View Slide

  7. DAY 1

    View Slide

  8. TODAY
    Memeification: David Ho

    View Slide

  9. R package landscape
    • Over 12,000 packages on CRAN
    • Plus Bioconductor, GitHub, etc.

    View Slide

  10. View Slide

  11. Photo: Sebastian Lengauer

    View Slide

  12. ggplot2

    View Slide

  13. View Slide

  14. WHY SHOULD I
    CONTRIBUTE TO R
    PACKAGES?


    View Slide

  15. Why contribute?
    • Make things work the way you want

    View Slide

  16. Why contribute?
    • Make things work the way you want
    • Opportunities, jobs, collaborations

    View Slide

  17. Why contribute?
    • Make things work the way you want
    • Opportunities, jobs, collaborations
    • Teach

    View Slide

  18. Why contribute?
    • Make things work the way you want
    • Opportunities, jobs, collaborations
    • Teach
    • Learn

    View Slide

  19. Photo: Ciprian Lipenschi

    View Slide

  20. Photo: Paul Frenzel

    View Slide

  21. Photo: Delaney Dawson

    View Slide

  22. Open issues 

    on GitHub

    View Slide

  23. View Slide

  24. View Slide

  25. REPREX
    minimal reproducible example

    View Slide

  26. library("ggplot2")
    ggplot(mtcars, aes(wt, mpg)) +
    geom_point()

    View Slide

  27. reprex()

    View Slide

  28. ``` r
    library("ggplot2")
    ggplot(mtcars, aes(wt, mpg)) +
    geom_point()
    ```
    ![](https://i.imgur.com/Ymw2m1B.png)
    Created on 2018-05-18 by the [reprex
    package](http://reprex.tidyverse.org)
    (v0.2.0).

    View Slide

  29. View Slide

  30. View Slide

  31. Photo: Sarah Dorweiler

    View Slide

  32. GITHUB ISSUES
    provide a reproducible, clean, parsimonious
    argument that this is a real problem worth fixing

    View Slide

  33. Survey existing
    issues on GitHub

    View Slide

  34. Survey existing issues
    • Answer questions
    • (Re)produce reprexes
    • Add information

    View Slide

  35. View Slide

  36. View Slide

  37. Improve
    documentation

    View Slide

  38. #' Add two numbers
    #'
    #' @param x The first nubmer
    #' @param y The second number
    #' @return The sum of the first
    #' and second number
    #'
    #' @examples
    #' add(2, 2)
    add <- function(x, y) {
    x + y
    }

    View Slide

  39. Documentation fixes
    • Typos
    • Confusing stuff
    • Out of date or inaccurate information
    • Examples

    View Slide

  40. View Slide

  41. Photo: Kawtar Cherkaoui

    View Slide

  42. Fix a bug!

    View Slide

  43. Contributing code
    • Start with an issue

    View Slide

  44. good first issue
    help wanted

    View Slide

  45. Photo: Olloweb Solutions
    BECOMING A BUG DETECTIVE

    View Slide

  46. Photo: Annie Spratt

    View Slide

  47. Photo: Jack Hunter

    View Slide

  48. traceback()
    Photo: Ryan Fields

    View Slide

  49. Photo: Bernard Hermant
    debug()

    View Slide

  50. Photo: Filip Mroz

    View Slide

  51. Bug hunting tips
    • Read the function(s)
    • Find the surrounding functions
    • traceback() and debug() are your friends

    View Slide

  52. Contributing code
    • Start with an issue

    View Slide

  53. Contributing code
    • Start with an issue
    • Submit a pull request containing your change

    View Slide

  54. View Slide

  55. Contributing code
    • Start with an issue
    • Submit a pull request containing your change
    • Update documentation
    • Tests prevent your fix from getting un-fixed
    • Follow code style

    View Slide

  56. Contributing code
    • Start with an issue
    • Submit a pull request containing your change
    • Update documentation
    • Tests prevent your fix from getting un-fixed
    • Follow code style
    • CONTRIBUTING.md

    View Slide

  57. Photo: Antony Xia

    View Slide

  58. START SMALL
    AND LEARN
    AS YOU GO
    You don’t need to be an expert to contribute
    through issues, comments, reprexes,
    documentation, or code

    View Slide

  59. View Slide

  60. More resources
    • “Contributing Code to the Tidyverse” by Jim Hester 

    http:/
    /www.jimhester.com/2017/08/08/contributing/
    • “Contributing to Tidyverse Packages” by Mara Averick

    https:/
    /www.rstudio.com/resources/videos/contributing-to-
    tidyverse-packages/
    • “Happy Git and GitHub for the useR” by Jenny Bryan

    http:/
    /happygitwithr.com/

    View Slide

  61. Photo: Agathe Marty

    View Slide

  62. Photo: Tom Johnson
    thanks!
    Acknowledgements:
    Thanks to Mara Averick, Tom Johnson, Sean
    Kross, Ross Donaldson, Hadley Wickham, 

    R-Ladies Seattle, and #rcatladies

    View Slide