Parse command line argument flags

parseArgs(positional = FALSE, validArgs = NULL, validFlags = NULL)

Arguments

positional

logical(1). Error if required positional arguments are missing.

validArgs

character or NULL. Valid key-value pair argument names. For example, aaa for --aaa=AAA.

validFlags

character or NULL. Valid flag names. For example, aaa for --aaa.

Value

character. Arguments.

Note

Updated 2020-04-07.

See also

  • argparse Python package

  • argparser R package

  • optparse R package

Examples

parseArgs()
#> character(0)
## $ Rscript test.Rscript --a="A" --b ## > parseArgs(positional = FALSE, validArgs = "a", validFlags = "b")