fontikar / DIY_Rpkg

Workshop materials for making your first R package πŸ“¦πŸ‘©β€πŸ’»

Home Page:https://fontikar.github.io/DIY_Rpkg/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

DIY R package workshop

Hello! Welcome! πŸ‘‹

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!

Meta data

I have also provided the bulk of the code in templates/:

  • say.R R script containing the say() function for ohwhaley
  • phrases.R R script containing phrases used by say()
  • test-say.R R script containing a simple test for say()
  • roxygen_template.R R script containing roxygen documentation for say()
  • data_template.R R script containing roxygen template for documenting external data
  • example_README.Rmd Rmd file for the README
  • example_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

Overview of workshop:

  1. What is an R package?
  2. Why make an R packge [a group discussion]
  3. The mise en place
  • R and RStudio
  • git and GitHub *optional, but recommended
  1. The basic packages
  • devtools
  • usethis
  • testthat
  • roxygen2
  • knitR
  1. Lets get coding! [the interactive part!]
  • The main set up
  • Your first function
  • Document it!
  • README
  • Vignette
  • Tests
  1. What makes a good R package? [a summary discussion] *if there is time
  2. Summary

Additional resources

If you want to give your package something extra:

About

Workshop materials for making your first R package πŸ“¦πŸ‘©β€πŸ’»

https://fontikar.github.io/DIY_Rpkg/

License:MIT License


Languages

Language:R 100.0%