R package development
2025-09-03
Welcome! Weβll start the workshop shortly
If you want to code along with me, please follow the set-up instructions β¬οΈ
If youβd prefer to just want to sit back and watch, thatβs fine too π
WiFi: RSS edin2025
It doesnβt have toβ¦
Itβs not just any box of random tools β itβs a kit that someone else should be able to pick up and use immediately without calling you for instructions.
biketools/

DESCRIPTIONbiketools/
ββ DESCRIPTION

R/ folderbiketools/
ββ DESCRIPTION
ββ R/
β ββ chain-braker.R
β ββ multitool.R
β ββ pedal-wrench.R
β ββ tyre-levers.R

man/ folderbiketools/
ββ DESCRIPTION
ββ R/
β ββ chain-braker.R
β ββ multitool.R
β ββ pedal-wrench.R
β ββ tyre-levers.R
ββ man/
β ββ chain-braker.Rd
β ββ multitool.Rd
β ββ pedal-wrench.Rd
β ββ tyre-levers.Rd

NAMESPACEbiketools/
ββ DESCRIPTION
ββ R/
β ββ chain-braker.R
β ββ multitool.R
β ββ pedal-wrench.R
β ββ tyre-levers.R
ββ man/
β ββ chain-braker.Rd
β ββ multitool.Rd
β ββ pedal-wrench.Rd
β ββ tyre-levers.Rd
ββ NAMESPACE

biketools/
ββ DESCRIPTION
ββ R/
β ββ chain-braker.R
β ββ multitool.R
β ββ pedal-wrench.R
β ββ tyre-levers.R
ββ man/
β ββ chain-braker.Rd
β ββ multitool.Rd
β ββ pedal-wrench.Rd
β ββ tyre-levers.Rd
ββ NAMESPACE
ββ data/
ββ pkgdown/
ββ tests/
ββ vignettes/
ββ README.md
ββ NEWS.md

usethis::create_package("sums")DESCRIPTION file and customise itusethis::use_mit_license()devtools::install()Copy the add() function in R/add.R
Add export(add) to NAMESPACE
Run devtools::load_all()
Try out your function add(3, 4)
Add some {roxygen2} strings
Run devtools::document(); devtools::load_all()
View the help file ?add
Inspect your toolbox before lending it out
devtools::check()Donβt worry if it doesnβt all pass!
Add cli_alert_success("You added two numbers") to add()
Run check
Prefix with cli::
Run check
Use usethis::use_package("cli") to update Imports:
Run check
use_readme_md()
use_roxygen_md()
use_news_md()
use_github_actions()
use_data()
use_testthat()
use_vignettes()
use_pkgdown()
devtools::load_all()@exportdevtools::document()devtools::load_all()devtools::document()devtools::check()devtools::install()Local install: devtools::install_local("biketools")
GitHub: devtools::install_github("statsrhian/biketools")
CRAN: install.packages("biketools.zip")
Remember to make a hex sticker
Let me know how you get on π§ @statsRhian
