[R] optparse::parse_args, using equals sign or not

Benjamin Tyner btyner at gmail.com
Wed Feb 8 13:06:58 CET 2012


Hi

We've found that when using parse_args(..., positional_arguments=FALSE), 
it is permissible to invoke our script with either "--myfoo=bar" or 
"--myfoo bar"; that is, whether or not the equals sign is present makes 
no difference, and in fact both usage forms are demonstrated in the 
optparse vignette.

However, we've found that when using parse_args(..., 
positional_arguments=TRUE), it is no longer possible to use the equals 
sign; that is, "--myfoo=bar" will show up as a positional argument, with 
"myfoo" set to its default value instead.

Wondering if this is really the intended behavior? Some of our scripts 
use positional arguments and some do not, and we'd like to arrive at a 
standard usage across all scripts.

Many thanks,
Ben


More information about the R-help mailing list