Personal R Packages

I came across this R package on GitHub, and it made me so excited that I decided to write a post about it. It’s a compilation by Karl Broman of various R functions that he’s found helpful to write throughout the years.

Wouldn’t it be great if incoming graduate students in Biostatistics/Statistics were taught to create a personal repository of functions like this? Not only is it a great way to learn how to write an R package, but it also encourages good coding techniques for newer students (since it encourages them to write separate functions with documentation). It also allows for easy reprodicibility and collaboration both within the school and with the broader community. Case in point — I wanted to use one of Karl’s functions (which I found via his blog… which I found via Twitter), and all I had to do was run:

install_github('broman','kbroman')
library('broman')

(Note that install_github is a function in the devtools package. I would link to the GitHub page for that package but somehow that seems circular…)

For whatever reason, when I think of R packages, I think of big, unified projects with a specified scientific aim. This was a great reminder that R packages exist solely for making it easier to distribute code for any purpose. Distributing tips and tricks is certainly a worthy purpose!

5 Comments

  1. Karl Broman says:

    Probably the best example of such a package is Frank Harrell’s Hmisc: http://biostat.mc.vanderbilt.edu/wiki/Main/Hmisc

    1. hilaryparker says:

      wow, 7 years of code! But I do love that yours is on GitHub.. the one line install was almost *too* easy. I’m accustomed to more struggle with R.

Leave a Comment