## Test
require(Xmisc)
parser <- ArgumentParser$new()
parser$add_argument('--a_str',type='character')
parser$add_argument('--b_num',type='numeric',default='0')
a_str
## character(0)
b_num
## [1] 0
message(parser$get_help())
## Usage:
## /bin/exec/R ...
## Description:
## Options:
## a_str character
## b_num numeric [ 0 ]
## Not run:
# ## Test from a command line
# R -q -e "
# require(methods);require(Xmisc);
# parser <- ArgumentParser\$new();
# parser\$add_argument('--a_str',type='character');
# parser\$add_argument('--b_num',type='numeric',default='0');
# printme(a_str);printme(b_num);parser\$get_help();
# " --args --a_str='Hello World!' --b_num=1
# ## Loading required package: Xmisc
# ## ## a_str ##
# ## [1] "Hello World!"
# ## ## b_num ##
# ## [1] 1
# ## ...
# ## End(Not run)
Run the code above in your browser using DataLab