That works fine, but there's a slightly neater way to do it; if you provide a TRUE value to the commandArgs function, it ignores any commandline parameters before (and including) --args.
It's also possible to use a simpler syntax to call the script on the command line, which implicitly assumes that any arguments are given after the script name: