[R-pkg-devel] speeding up package code/build/test cycle

Dirk Eddelbuettel edd @end|ng |rom deb|@n@org
Thu Jun 24 15:48:42 CEST 2021

Hi Greg,

On 24 June 2021 at 12:15, Greg Minshall wrote:
| when developing packages, my current work flow is to change the code,
| (re-)build the package, detach/load the package, test (to find the
| N+1'st bug, sigh).
| the building step takes tens of seconds.

You may benefit from looking into ccache, I wrote about it a few times in a
few places including http://dirk.eddelbuettel.com/blog/2017/11/27/

If you enable it via ~/.R/Makevars as I do then it helps for all package
installations from shell or IDE or ...  I find it rather helpful esp with
compiled code. If you only write R code it will not help you.

| is there an obvious way to present some code to the R command line and
| have it replace the appropriate function in a given package?
| or, are there other things people do to speed up this process?

There are a few options to R CMD build and R CMD INSTALL that may help. I use
a front-end script 'build.r' (from my littler package) where '-f' enables
fast mode skips vignette and (pdf) manual building which tend to slow me
down. If you look at 'R CMD INSTALL --help' you will see a few more that may

I find I am happier with write/build/test cycle from the shell as I am then
guaranteed to have clean and pristine R sessions. By having front-end scripts
(to build and/or install) I can then easily have very compact shell
expressions you can simply Ctrl-r for, or, as you too are an Emacs user, use
'Ctrl-x c' to trigger the compile command ... which is both a) editable so I
can replace the 'make -f' default and b) has its own history so I can cycle
through commands and/or get back to recent ones. "Works for me", YYMV.

Cheers, Dirk

https://dirk.eddelbuettel.com | @eddelbuettel | edd using debian.org

More information about the R-package-devel mailing list