Search code examples
gitrcran

How to use git in R package development?


I'm new to R and have started writing a medium-size project. Even though it will be distributed as part of an application, I've decided to make a package out of it to make the organisation neater.

How do I handle the fact that the DESCRIPTION file needs Version and Date fields, when I'm using version control? I wouldn't want to change that file with every git commit.

Is there a standard Makefile somewhere for this?

Further, I'm not completely clear on how I'd do this and still be able to use the package while developing.


Solution

  • If you use the devtools package you don't have to build and install your package after each edit - just use load_all() and the job is done in your working session, so you can test your changes (ideally with the testthat package).

    I wrote an RPub about it: http://www.rpubs.com/geospacedman/lazydevtools

    You still get the option to build a package source tarball for distribution.

    Note that git doesn't promote a mechanism for automatically updating bits of files with every commit, like the $id$ thing in SVN. Linus himself said it was 'idiotic' and 'stupid':

    http://www.gelato.unsw.edu.au/archives/git/0610/28891.html