• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1
2args = commandArgs(TRUE);
3
4args.options = list();
5
6temp.option.key = NULL;
7
8for (arg in args) {
9  # Optional arguments declaration
10  if (substring(arg, 1, 1) == '-') {
11    temp.option.key = substring(arg, 2);
12    if (substring(arg, 2, 2) == '-') {
13      temp.option.key = substring(arg, 3);
14    }
15
16    args.options[[temp.option.key]] = TRUE;
17  }
18  # Optional arguments value
19  else if (!is.null(temp.option.key)) {
20    args.options[[temp.option.key]] = arg;
21
22    temp.option.key = NULL;
23  }
24}
25