Introduction


  • An R package is a project in a standardized folder structure.
  • An R package centers around R functions.
  • RStudio is a useful editor that helps you package your project.

Accessing packages


Getting started


  • “A package is no more and no less than a folder structure”
  • “RStudio can help you”

Writing our own functions


  • “It is important to think about what we want our package to do (design) and how to do it (implementation). We also want to know why we need a new package (avoid reinventing the wheel)”
  • “Functions have to be saved in .R files in the R folder”

Licenses


  • A license is essential to allow the use and reuse of your package.
  • The copyright holder(s) decide(s) on the license.
  • It is easy to add an open source license to a new R package.

Testing


  • Tests help you write a reliable package
  • A failing test provides a lot of valuable information
  • Checking goes deeper than testing

Managing dependencies


  • The DESCRIPTION file helps us keeping track of our package’s dependencies

Documenting your package


  • Documentation is not optional
  • All coding projects need a readme file
  • roxygen2 helps us with the otherwise tedious process of documenting
  • roxygen2 also takes care of NAMESPACE

Data


  • R packages can also include data

Vignettes


  • Show how to use your functions in a vignette
  • With RMarkdown, we can combine text, code, and output to a single document
  • Vignettes are an integral part of an R package.