Skip to content
Prev 31581 / 398506 Next

commandArgs()

Apologies for asking about this, but I don't quite understand how
this works after looking through the FAQ and the Help archives.

Let's say I want to pass "1000" as an argument to R.  I did the
following:
When I do print( commandArgs() ), I see

[1] ".../R.bin"         "--restore"
[3] "--save"            "--no-readline"
[5] "gui=none"          "--1000"

So commandArgs()[6] is the argument I want.  Does one then go on and
remove the "--" manually and cast this as numeric?  If so, what's the
usual way to do this?  Or am I not understanding this mechanism
properly?

Thanks very much.