If You Can Write a Function
2026-02-25
๐16:00 - 18:00 GMT
๐งโ๐ป Code along on your laptop or Posit Cloud
๐ฌ Tell me: Have you built a ๐ฆ? Why not?
๐งฎ NHS Data Scientist
๐ฃ๏ธ Stats communicator
๐ฉโ๐ป #RStats educator
๐ Community champion
๐ rhian.rbind.io

๐ฃโโ๏ธ ๐ดโโ๏ธ๐งโโ๏ธ ๐โโ๏ธ๐โโ๏ธ๐๐ผ ๐ฅ ๐งถ๐ณ๏ธโ๐ she/her
It doesnโt have toโฆ
Building R packages can feel empowering and can be addictive.
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

DESCRIPTION fileusethis::create_package("sums")1DESCRIPTION fileusethis::use_mit_license()devtools::install()add() function to the package in R/1install vs load_all()install()
load_all()
devtools::load_all()add.R work now?Copy the add() function in R/add.R
Run devtools::load_all()
Try out your function add(3, 4)

#' @export tagNAMESPACE?dplyr::slice_head?@export: exports the function@param: what does an argument do? what are the defaults?@returns: what type of object does the function return?@examples: show the function in action#devtools::document()Add some {roxygen2} strings
Run devtools::document(); devtools::load_all()
View the help file ?add
1 error โ | 1 warning โ | 2 notes โ
devtools::check()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
Add cli::cli_alert_success("You added two numbers") to add()
Run check
Use usethis::use_package("cli") to update Imports:
Run check
Local install: devtools::install_local("biketools.zip")
GitHub: devtools::install_github("statsrhian/biketools")
CRAN: install.packages("biketools")
use_readme_md()
use_data()
use_testthat()
use_vignettes()
use_pkgdown()
use_news_md()
use_github_actions()
Remember to make a hex sticker
Let me know how you get on ๐ง @statsRhian
