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

Trevor Davis trevor.l.davis at gmail.com
Thu Feb 16 10:55:49 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

This bug when using long flag arguments with an equals sign when
positional_arguments=TRUE was fixed in the version of optparse just
uploaded to CRAN (version 0.9.5).  Windows and MAC binaries are being
compiled (and are also available on R-Forge).

Trevor



More information about the R-help mailing list