R capable version of ant
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.
ant is an amazing build tool. I have been using ant for some time to build the java code that lives inside the src directories of my R packages, see this post for example.
The drawbacks of this approach are :
- that it assumes ant is available on the system that builds the package
- You cannot use R code within the ant build script
The ant package for R is developed to solve these two issues. The package is source-controlled in r-forge as part of the orchestra project
Once installed, you find an ant.R
script in the exec
directory of the package. This script is pretty similar to the usual shell script that starts ant, but it sets it so that it can use R with the following additional tasks
: to run arbitrary R code : to set a property of the current project with the result of an R expression
Here is an example build file that demonstrate how to use these tasks
Here is what happens when we call the R special version of ant with this build script
$ `Rscript -e "cat( system.file( 'exec', 'ant.R', package = 'ant') )"` Buildfile: build.xml test: [echo] [echo] R home : /usr/local/lib/R [echo] R version : R version 2.10.0 Under development (unstable) (2009-08-05 r49067) [echo] rJava home : /usr/local/lib/R/library/rJava [echo] rJava version : 0.7-1 [echo] BUILD SUCCESSFUL Total time: 1 second
R-bloggers.com offers daily e-mail updates about R news and tutorials about learning R and many other topics. Click here if you're looking to post or find an R/data-science job.
Want to share your content on R-bloggers? click here if you have a blog, or here if you don't.