Brandon Bertelsen Brandon Bertelsen - 5 months ago 12
R Question

How to run script contained in a package from shell

Is there an elegant way to run a script contained in an installed package from the command line, with arguments.

So, I'm aware that we could do something like:

Rscript path/package/scritpts/script.R arg1 arg2 arg3

But I'd like something that's more elegant. Because
can be ridiculous sometimes.


Dirk has provided a viable solution by way of his littler package:

Rscript $(R -e 'cat(system.file("scripts","file.R",package = "pkg"))') arg1 arg2 arg3