I want to execute an R script via command line parsing arguments to it. I know this can be done like this:
Rscript script.R arg1 arg2, and that the arguments can be read in the R script as:
args <- commandArgs(trailingOnly = TRUE) input1 = args input2 = args
but I was wondering: is there a way to define flags (e.g.,
--input) those arguments can be provided with, so that I do not have to worry about the order in which I provide them? I have looked around quite a while, but was not able to find a way.
Any help would be much appreciated!