I have written a series of functions to allow easier 'arg-parse'-type commandline argument parsing and check in R. I have run into the issue briefly mentioned here but still don't entirely understand whats going on. It seems that when trying to use "-g" as a flag,
$ Rscript test_args.R -g foo
where test_args.R is simply:
#minimal program for reproducing "-g" arg behaviour
args<-commandArgs(T)
print(args)
I get the error and output:
WARNING: unknown gui 'foo', using X11
[ 1 ] "-g" "foo"
it interprets that as something to change the GUI prior to actually running the script test_args.R (although the printed message shows that the "-g" does actually make it to the actual R program). This isn't mentioned in the Rscript man page, or anywhere else I can find.
Is there any way around this, and if not, is there a list of any other potential off-limits argument flags?
Thanks in advance!
EDIT: based of of this post, I tried adding either the hash-bang #!/usr/bin/Rscript, but would ideally like to avoid users having to install littler to use the #!/usr/local/bin/r option if possible...