R package development and pkgdown

Introduction to building and documenting R packages
Author
Affiliation

Department of Biostatistics, Johns Hopkins

Published

November 26, 2024

Pre-lecture activities

Important

In advance of class, please install two additional packages:

  • devtools - this provides many additional tools for building packages
  • roxygen2 - this provides tools for writing documentation
  • pkgdown - this helps you to build a package website with little effort
  • usethis - an automation package that simplifies project creation and setup

You can do this by calling

install.packages(c("devtools", "roxygen2",
                   "usethis", "pkgdown"))

In addition, please read through:

Lecture

Acknowledgements

Material for this lecture was borrowed and adopted from

Learning objectives

Learning objectives

At the end of this lesson you will:

  • Create an empty R package
  • Design a R function and write documentation
  • Describe what a DESCRIPTION file is and what goes in it
  • Be able to build and install a R package
  • Build a website for your package

Slides