I have a simple script shell that builds my Roxygen documents, builds a package, validates, and then installs a newly created package on my computer. It is pretty simple:
#! /bin/sh
R CMD roxygen -d myPackage
R CMD build myPackage/
R CMD check myPackage_0.01.tar.gz
R CMD INSTALL myPackage myPackage_0.01.tar.gz
But I am having problems with Roxygen, which executes my .onLoad () function as https://stackoverflow.com/a/167272/2 . The solution is to use the use.Rd2 = TRUE option with roxygenize. Well, I want to build from the command line, so I changed this line
R CMD roxygen -d myPackage
to the next line, which forces the roxygenize line to R via stdin:
echo 'require("roxygen"); roxygenize("myPackage", roxygen.dir="myPackage",
copy.package=FALSE, use.Rd2=TRUE)' | R --no-save < /dev/stdin
This one seems to work only dandy. But he feels a little confused. Is there an easier and / or more elegant way?