
This workshop focuses on the most critical aspects of moving from standalone functions to an R package. It prioritizes hands-on experience while providing essential theoretical knowledge.
The workshop allows participants to:
- Understand the basics of R packages
- Learn the practical steps of creating a package
- Get hands-on experience in package development
- Provide best practices and references for self study
Given the time constraint, some topics have been condensed.
Be sure to have the following software tools installed:
Agenda:
| Topic | Time | |
|---|---|---|
| Introduction | - Why packaging functions in R - Overview of necessary tools: R, RStudio, devtools, roxygen2, testthat, pkgdown |
15 minutes |
| R Package Essentials | - Structure of an R package - Key components: DESCRIPTION, NAMESPACE, R/, man/ |
20 minutes |
| Create Your First Package | - Setting up a new package project in RStudio - Update the DESCRIPTION file - Moving functions into the package structure - Writing documentation with roxygen2 - Using devtools functions: document(), check(), build(), install() - Addressing common errors and warnings |
40 minutes |
| Testing | - Why test? - Unit-tests with testthat and devtools function test() - Key expectations - Test file structure |
20 minutes |
| Building a documentation website | - Structure of a documentation website - Use pkgdown package |
10 minutes |
| Q&A and Best Practices | - Resources for good package development - Q&A session |
15 minutes |
For any questions on the agenda contact Damiano Oldoni Research Software Developer at the Research Institute for Nature and Forest, Open science lab for biodiversity.
This workshop is part of the B-Cubed project's educational series. B-Cubed is standardising access to biodiversity data, empowering policymakers to proactively address the impacts of biodiversity change. GBIF is a key partner of the project. B-Cubed (Biodiversity Building Blocks for policy) receives funding from the European Union’s Horizon Europe Research and Innovation Programme (ID No 101059592).