In creating a command line tool using R, I decided to use the docopt package. It works for passing flags, but I can't figure out how to pass two numeric values. See the below code:
#! /usr/bin/Rscript
'
usage:
./test.R [-L <low> -H <high>]
options:
-h --help Shows this screen
-L <low>, --low <low> Passes low risk investiment
-H <high>, --high <high> Passes high risk investiment
' -> doc
library(docopt)
# retrieve the command-line arguments
opts <- docopt(doc)
# what are the options? Note that stripped versions of the parameters are added to the returned list
cat(opts$high)
cat(opts$low)
str(opts)
Whenever I try to run using ./test.R -L 2000 -H 4000 it warns me that the methods package is being loaded and returns nothing else.
What is my mistake here (using R version 3.4.1 with docopt from CRAN)?
In creating a command line tool using R, I decided to use the docopt package. It works for passing flags, but I can't figure out how to pass two numeric values. See the below code:
Whenever I try to run using
./test.R -L 2000 -H 4000
it warns me that the methods package is being loaded and returns nothing else.