13

I have a package that uses both Rcpp and Roxygen2. I'd like to have R CMD build run a small prebuild script that runs compileAttributes() and and roxygenise() before it starting the build process. Is there a hook or mechanism to do this?

James Howard
  • 1,258
  • 2
  • 11
  • 26
  • [`devtools`](https://github.com/hadley/devtools/) is written to make these things easier. – mnel May 19 '14 at 02:42

1 Answers1

7

As @mnel suggested, you could use a build script using devtools. Say a script named build.r:

library(devtools)
document()
compileAttributes()
someotherscript()
build()
sebastian-c
  • 15,057
  • 3
  • 47
  • 93
  • could you clarify this a little more? The devtools package seems to run `document()` and the `R CMD INSTALL` when I click 'Install and restart'. Does it also look for a file named build.r? – rcorty Mar 07 '19 at 16:25
  • 1
    No, the idea would be to make a script that you use when you want to build. The only way I can think of to trigger this using Rstudio is by making a custom add-in so you can use a keyboard shortcut. – sebastian-c Mar 09 '19 at 00:37