Skip to content
Hilmar Lapp edited this page Mar 17, 2015 · 11 revisions

This page contains useful material, links and resources for our bootcamps.

R package development

some basics

Some relevant material on R package development can be found from Hackout2: GRINDER's website:

https://sites.google.com/site/hackout2/developers-corner/developing-r-packages

The part on the vignette and writing documentation is slightly outdated.

using devtools

This package will make your life tremendously easier as a developper. Some useful functions include:

  • create: create a new package skeleton
  • install: installs the package in the indicated path (default=current directory)
  • check: runs CRAN checks on the package - stuff you need to pass to be able to submit to CRAN
  • document: will extract all the documentation from your code (roxygen2), generate Rd files, generate your NAMESPACE
  • install_github: install a package which is hosted on github
  • add_travis: adds Travis configuration file to your package

documenting your functions using roxygen2

roxygen2 is an awesome way to document a package. The basic idea is to embed the documentation of a function as annotation of the code, with specific tags indicating what part is documented. This can then be extracted automatically from the sources files to generate Rd files. This is best shown using an example:

https://github.com/Hackout2/incidence/blob/master/R/plotIncidence.R

also check http://r-pkgs.had.co.nz/

Rmarkdown

By now, you all should be familiar with markdown (as it's used to write in this repository). Rmarkdown is a flavor of markdown that allows you to write and document R code in a reproducible and readable manner. To get started, you can read Karl Broman's introduction. For reference, Rstudio has also created this handy cheat sheet for quick reference.

Git & Github

A very good introductory lesson on Git is Software Carpentry's Git Novice lesson. It includes a Git command and vocabulary reference.

Github includes a whole site devoted to training classes, materials and resources, including a nice two-page cheat sheet.

Cheat sheets