# Workshop description and agenda ## Workshop description 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: - [R](https://www.r-project.org/) (preferably 4.0 or higher) - [RStudio](https://posit.co/downloads/) - R packages: [devtools](https://devtools.r-lib.org/), [roxygen2](https://roxygen2.r-lib.org/index.html), [usethis](https://usethis.r-lib.org/), [testthat](https://testthat.r-lib.org/), [pkgdown](https://pkgdown.r-lib.org/) This workshop is part of the [B-Cubed](https://b-cubed.eu/) 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). ## Agenda ### 1. Introduction (15 minutes) - Why packaging functions in R - Brief overview of necessary tools: R, RStudio, devtools, roxygen2, testthat, pkgdown ### 2. R Package Essentials (20 minutes) - Structure of an R package - Key components: DESCRIPTION, NAMESPACE, R/, man/ ### 3. Create Your First Package (40 minutes) - 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 ### 4. Testing (20 minutes) - Why test? - Unit-tests with testthat and devtools function test() - Key expectations - Test file structure ### 5. Building a documentation website (10 minutes) - Structure of a documentation website - Use pkgdown package ### 6. Q&A and Best Practices (15 minutes) - Resources for good package development - Q&A arena Total time: 2 hours