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 full-size slide

  2. Photo: Asa Rodger
    THE STRUGGLE IS REAL

    View full-size slide

  3. Photo: Elaine Casap

    View full-size slide

  4. Photo: Asa Rodger

    View full-size slide

  5. Photo: Andrew Seaman

    View full-size slide

  6. diverse fields

    View full-size slide

  7. TODAY
    Memeification: David Ho

    View full-size slide

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

    View full-size slide

  9. Photo: Sebastian Lengauer

    View full-size slide

  10. WHY SHOULD I
    CONTRIBUTE TO R
    PACKAGES?


    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

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

    View full-size slide

  15. Photo: Ciprian Lipenschi

    View full-size slide

  16. Photo: Paul Frenzel

    View full-size slide

  17. Photo: Delaney Dawson

    View full-size slide

  18. Open issues 

    on GitHub

    View full-size slide

  19. REPREX
    minimal reproducible example

    View full-size slide

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

    View full-size slide

  21. ``` 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 full-size slide

  22. Photo: Sarah Dorweiler

    View full-size slide

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

    View full-size slide

  24. Survey existing
    issues on GitHub

    View full-size slide

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

    View full-size slide

  26. Improve
    documentation

    View full-size slide

  27. #' 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 full-size slide

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

    View full-size slide

  29. Photo: Kawtar Cherkaoui

    View full-size slide

  30. Contributing code
    • Start with an issue

    View full-size slide

  31. good first issue
    help wanted

    View full-size slide

  32. Photo: Olloweb Solutions
    BECOMING A BUG DETECTIVE

    View full-size slide

  33. Photo: Annie Spratt

    View full-size slide

  34. Photo: Jack Hunter

    View full-size slide

  35. traceback()
    Photo: Ryan Fields

    View full-size slide

  36. Photo: Bernard Hermant
    debug()

    View full-size slide

  37. Photo: Filip Mroz

    View full-size slide

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

    View full-size slide

  39. Contributing code
    • Start with an issue

    View full-size slide

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

    View full-size slide

  41. 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 full-size slide

  42. 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 full-size slide

  43. Photo: Antony Xia

    View full-size slide

  44. 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 full-size slide

  45. 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 full-size slide

  46. Photo: Agathe Marty

    View full-size slide

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

    R-Ladies Seattle, and #rcatladies

    View full-size slide