Skip to content
Back to formatted view

Raw Message

Message-ID: <Law11-F120XHwGrRDyj00024819@hotmail.com>
Date: 2003-05-05T14:34:57Z
From: R A F
Subject: 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:

>R CMD BATCH --1000 infile outfile

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.