How do i pass (and parse) arguments to my R script using the run configuration option in eclipse?
I am using Eclipse Mars - StatET 3.5.1 - R 3.2.2
Normally from the command line i do something like this:
Rscript myscript.R argument1 argument2
And in myscript.R:
args <- commandArgs(trailingOnly = TRUE)
file1 <-args[1]
file2 <-args[2]
#do some stuff with file1 and file2
For testing python scripts, i use the run configuration option and create a list of arguments there. This seems to be an option for R as well. But i cannot seem to get this to work.
I go to Run Configurations -> R Console and add the arguments to the Options/Arguments section under "Main" in the right panel for my new run configuration.
But if i press Run, it just opens a new R session and all arguments seem to be forgotten. My object browser shows 'args' as an empty string
Any thoughts on how to pass the arguments so my R session knows them?
Many Thanks! Linda