Is it possible to build packages from within R instead of from the command line calling R? I looked at ?build help file 开发者_运维百科and also goggled but no luck. Maybe its not possible?
It has to be possible (but not necessarily easy). R CMD build
used to be a Perl script, but it's been a pure R function for some time; I can't remember the exact version when the switch occurred.
I (again) urge you to search for answers via rseek.org (not Google) before asking here. The 6th hit for "R CMD build"
is build.R from the svn repository. I bet you could take a look at that script and figure out how to build a package from R.
If that doesn't work, you can always issue a shell command from R: system("R CMD build myPackage.tar.gz")
.
It's actually possible by calling tools:::.build_packages('pkname')
. You can also add arguments, i.e.: tools:::.build_packages(c('--md5', 'pkname'))
.
But be aware that this will quit your R session after completion so I don't know how useful it is.
Yes, using build, check, etc from the "devtools" package.
library("devtools")
help (package="devtools")
精彩评论