Day14: Developing an R package

Posted by csiu on March 10, 2017 | with: 100daysofcode

Yet another late night celebration. In today’s post, I’ll introduce an R package that I have been developing (codewise) for the past week. This package (hmmpickr) is intended to be a deliverable accompanying my MSc thesis work and journal article (which I plan to submit to within the next week).

About hmmpickr

ChromHMM (Ernst & Kellis, 2012), an implementation of a hidden Markov model (HMM), uses epigenetic features such as histone modifications to represent observed (or output) states and unobserved (or hidden) states to represent chromatin states. Due to the nature of hidden states, the number of states will need to be specified programmatically and oftentimes numerous candidate models are generated. The goal of hmmpickr is to quantitatively help pick the model whose states are the most well-defined.

We use this tool as follows:

Creating R packages

In creating an R package, you will need to minimally create:

  1. DESCRIPTION file
  2. NAMESPACE file
  3. Rscripts in R/
  4. Documentations in man/

A couple of good resources include:

  • R packages” by Hadley Wickham for creating R packages
  • Introduction to roxygen2” by Hadley Wickham (2017) for generating the documentation in man/ from Rscripts using roxygen2