A Comically Brief Intro to devtools

(and healthvis!)

Prasad Patil

Building R Packages

R packages are simply directories with a particular structure.

Bare bones: R/, DESCRIPTION

Recommended: man/, NAMESPACE

Optional: README, NEWS, CITATIONS, tests/, demo/, src/, etc.

You can pretty easily create an initial package yourself, but devtools makes developing a package much easier

Devtools (and roxygen2, and testthat...)

4 Steps to Glory

  1. Install devtools, roxygen2, testthat

  2. create(PATH)

  3. Put your R files into R/

  4. document(PATH)

Our sweet function

#' Square a number
#'
#' \code{square_me} is a function that squares a number.
#'
#' @param x A number
#' @return x^2
#' @export
#' @examples
#' x <- 5
#' square_me(x)

square_me <- function(x) {
    x^2
}

Break for a little demo

Interactive graphics

Healthvis

  • Reusable visualizations
  • No javascript/HTML knowledge required
  • One line of R code in the familiar way
  • Easy sharing and embedding of your figure

http://healthvis.org