View on GitHub

Tutorial

Materials for a workshop in Aug 2025

Packaging and sharing your code

Website: https://numbat-tutorials.github.io/tutorial_packaging_your_code


Sharing your R code doesn’t have to be a messy email chain or a zip file with cryptic scripts. In this hands-on workshop, you’ll learn how to wrap your code into a professional R package that’s easy to use, easy to share, and easy to maintain. We’ll guide you through the whole process—from setting up the structure to documenting your functions and publishing your work online, including websites for your documentation and submission to CRAN.

Presenters

Background

You will need a basic understanding of R to the level explained in R4DS. Some knowledge of Quarto or RMarkdown will be useful.

Knowledge of git, and an ability to use GitHub is advised. To follow all the exercises, needs you to have a GitHub account ready for this tutorial.

Structure of the tutorial

Session 1: Creating a package for your code

This session will guide you through creating your first package for your code. This will include:


Session 2: Sharing your code on the web

This session will show you how you can share your code to others on the internet. This will include:

Getting started

  1. Ensure you have R and RStudio by following these instructions
  2. Set up a GitHub account if you don’t already have one, and make sure your SSH keys are set up. It’s not essential for this workshop but eventually your package should be made available in a GitHub repo, so this is a good time to start.
  3. Install Quarto from here
  4. Install the required packages for the workshop:
    install.packages(c("pkgdown","usethis","devtools"))
    

Copyright: Michael Lydeamore 2025

These materials are licensed under a Creative Commons Attribution-NonCommercial-ShareAlike 4.0 International License.

CC BY-NC-SA 4.0