A new package has appeared on CRAN called minimist, which implements an interface to the popular JavaScript library. This package has only one function, used for argument parsing. For example in RGui on OSX, the output of commandArgs() looks like this:
<span>></span> <span>commandArgs</span><span>()</span>
<span>[</span><span>1</span><span>]</span> <span>"R"</span> <span>"--no-save"</span> <span>"--no-restore-data"</span> <span>"--gui=aqua"</span>
Minimist turns that into this:
<span>></span> <span>library</span><span>(</span>minimist<span>)</span>
<span>></span> minimist<span>(</span><span>commandArgs</span><span>())</span>
<span>$</span><span>`_`</span>
<span>[</span><span>1</span><span>]</span> <span>"R"</span>
<span>$</span><span>save</span>
<span>[</span><span>1</span><span>]</span> <span>FALSE</span>
<span>$</span><span>`restore-data`</span>
<span>[</span><span>1</span><span>]</span> <span>FALSE</span>
<span>$</span>gui
<span>[</span><span>1</span><span>]</span> <span>"aqua"</span>
Note how ...