Is there a package to handle command line options in R?
I know commandArgs, but it's too thorough. Its result is basically equivalent to argcand argvin C, but I need something beyond that, just like boost::program_optionsin C++or GetOptions::Longin perl.
In particular, I would like to indicate in advance which parameters are allowed, and give an error message if the user indicates something else.
The call will be like this (with custom parameters - width = 32 --file = foo.txt):
R --vanilla --args --width=32 --file=foo.txt < myscript.R
or, if used Rscript:
myscript.R
(Please don’t say: “Why don’t you write it yourself, it’s not so difficult.” In other languages, you don’t need to write either. :)