The One with the Thoughts of Frans

Conveniently Developing an R Package

Half a decade ago I neglected to jot this down, so I had to figure it out again. Just in case someone landed here searching for the most basic R problem, you start the program using uppercase R, not lowercase r. Anyway, to work with a package in a git repository or some such the easiest method is the devtools package.

install.packages('devtools')
library(devtools)
load_all()

Without any parameters, the load_all() function from devtools loads the current directory without installing. You could effect the same with more keystrokes using load_all('./'), and of course you can pass any path instead of relying on the current working directory. But in combination with git I find it easiest to just stick with that. After you’ve made some changes in the source, just run load_all() again.

Tags:

Leave a Comment

You must be logged in to post a comment.