On 28/11/2011 2:48 PM, Hadley Wickham wrote:
It'd be cool if R CMD was user extensible through packages, so that (e.g.)

R CMD mypackage::mycommand

would do something like:

path<- system.file("cmd", paste(command, ".r"), package = package)
if (!file.exists(path)) {
   stop("Command ", command, " in ", package, " does not exist")
} else {
   source(path)
}

And maybe `R CMD mypackage` would look in mypackcage/cmd/default.r.


That does seem to mix up namespaces quite a bit. But what does it get you that "Rscript -e" doesn't already give you? You can set up your package so that

R CMD mypackage::mycommand

executes a function, using delayedAssign or some of the more exotic features (like external pointers and finalizers).

Duncan Murdoch

______________________________________________
R-devel@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-devel

Reply via email to