Skip to content

Session 5 guide

Selin Jessa edited this page May 25, 2020 · 10 revisions

Code working group - Session 5

Agenda

  • 20 min: debugging and questions
  • 10 min: vignettes
  • 10 min: packaged data
    • Intro (why, examples, internal vs. external, documentation)
    • Demo of saving some new data with usethis::use_data_raw() and usethis::use_data(), following https://r-pkgs.org/data.html#data-data
  • Run through the whole branch/commit/PR workflow once again

Task

Requirements: it's not absolutely necessary, but the 📦 {usethis} package is a great help for working w/ vignettes & package data.

Following the same workflow as before:

  1. Create an issue describing your new feature
  2. Pull changes to the sandbox repo
  3. Branch from develop-private & checkout to the issue branch
  4. Make changes, add, commit
  5. Rebase onto develop-private
  6. Push changes
  7. Watch the Travis status check, and debug until it passes (repeat steps 4, 6, 7 as needed until the commit gets a ✅)
  8. Open a pull request with develop-private (NOT master-private) as the base branch

This time,

  • Add to the vignette, demo-ing one or both of the functions you created over the last few weeks, by editing vignettes/sandbox-demo.Rmd. (To make a new vignette, you would run usethis::use_vignette("my-vignette") - you can try this out)
  • "Create"* some data, add it to the package, and document it, using usethis::use_raw_data("my-dataset") followed by usethis::use_data("my-dataset"), and then documenting it in the file in the R directory, called data.R

That's it! 🎉 Congrats, now you know everything you need to be an R package developer! ✨

* Doesn't have to be fancy, you can make a vector, manipulate the mtcars or iris datasets, get some values from rnorm(), etc!

Resources

This book is awesome: https://r-pkgs.org/

Clone this wiki locally