For this interactive workshop, we will be making ohwhaley the R package together π
Participants should have the following ready for the workshop
- The most recent version of R (β₯ 4.1) and RStudio (β₯1.4) installed
- The following package(s) and their dependencies installed: devtools, testthat, knitr
- Basic understanding of how to write a function
- Basic usage of git *optional but recommended
- Basic understanding of project directories and .Rproj files
For the workshop, we will be working from main_functions.Rmd
This file is also neatly rendered here: https://fontikar.github.io/DIY_Rpkg/
I have included the clipboard function for each chunk so its easier for everyone to follow along the workshop!
I have also provided the bulk of the code in templates/
:
say.R
R script containing thesay()
function forohwhaley
phrases.R
R script containing phrases used bysay()
test-say.R
R script containing a simple test forsay()
roxygen_template.R
R script containing roxygen documentation forsay()
data_template.R
R script containing roxygen template for documenting external dataexample_README.Rmd
Rmd file for the READMEexample_vignette.Rmd
Rmd file for the vignette
I have also included my slides in slides/
Read more about R packages, I recommend the 2nd Edition of The R packages book by Hadley Wickham and Jenny Byran
- What is an R package?
- Why make an R packge [a group discussion]
- The mise en place
- R and RStudio
- git and GitHub *optional, but recommended
- The basic packages
- devtools
- usethis
- testthat
- roxygen2
- knitR
- Lets get coding! [the interactive part!]
- The main set up
- Your first function
- Document it!
- README
- Vignette
- Tests
- What makes a good R package? [a summary discussion] *if there is time
- Summary
If you want to give your package something extra:
- Badges in your README
- Hexsticker in your README and to print π
- Pkgdown website
- Continuous integration using GitHub Actions