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?
Running a pre-build script when building an R package
As @mnel suggested, you could use a build script using devtools
. Say a script named build.r
:
library(devtools)
document()
compileAttributes()
someotherscript()
build()
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? –
Magbie 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. –
Cimah
© 2022 - 2024 — McMap. All rights reserved.
devtools
is written to make these things easier. – Leyden