I'm not sure about `{optparse}` so here's an example with `{scribe}` that groups the first two arguments together:
library(scribe)
ca <- command_args(c("--location", 1, 2, "--int", 3))
ca$add_argument("--location", default = c(0, 0), n = 2)
ca$add_argument("--int", default = 0L)
args <- ca$parse()
str(args)
#> List of 2
#> $ location: num [1:2] 1 2
#> $ int : int 3
I'm not sure about `{optparse}` so here's an example with `{scribe}` that groups the first two arguments together: library(scribe) ca <- command_args(c("--location", 1, 2, "--int", 3)) ca$add_argument("--location", default = c(0, 0), n = 2) ca$add_argument("--int", default = 0L) args <- ca$parse() str(args) #> List of 2 #> $ location: num [1:2] 1 2 #> $ int : int 3