Brandon Bertelsen Brandon Bertelsen - 1 year ago 65
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.

Answer Source

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  
Recommended from our users: Dynamic Network Monitoring from WhatsUp Gold from IPSwitch. Free Download