I run a Windows batchfile (.bat)
path_to_Rscript.exe file.R parameter1 parameter2 parameter3
on a file called file.R
In file.R, I read the arguments using
commandArgs(trailingOnly = TRUE)
ABC <- args[1]
DEF <- args[2]
GHI <- args[3]
In case there is no parameter2, calling only
path_to_Rscript.exe file.R parameter1 parameter3
how can I make sure that parameter3 is not assigned to DEF?
So far, I used %% as a placeholder, but I am not sure whether this is a common approach.
Is there a general placeholder for empty parameters?