Please see also ?commandArgs
Uwe Ligges
Darren Weber wrote:
-- Forwarded message --
From: Darren Weber <[EMAIL PROTECTED]>
Date: Apr 8, 2005 1:16 PM
Subject: Re: [R] Is a .R script file name available inside the script?
To: Gabor Grothendieck <[EMAIL PROTECTED]>
Right,
-- Forwarded message --
From: Darren Weber <[EMAIL PROTECTED]>
Date: Apr 8, 2005 1:16 PM
Subject: Re: [R] Is a .R script file name available inside the script?
To: Gabor Grothendieck <[EMAIL PROTECTED]>
Right, I understand, it could be in.txt has:
scriptfile <- &qu
I think you might want 'commandArgs()' which gives you the original
command line call.
-roger
Darren Weber wrote:
Hi,
if we have a file called Rscript.R that contains the following, for example:
x <- 1:100
outfile = "Rscript.Rout"
sink(outfile)
print(x)
and then we run
source("Rscript.R")
we ge
It works for me. Suppose in.txt is a two line file with these two lines:
file <- "Rscript.R"
source(file)
and Rscript.R is a two line file with these two lines:
script.description <- function() eval.parent(quote(file), n = 3)
print(basename(script.description()))
Then here is the output on Win
That is useful, when calling the script like this:
> file <- "Rscript.R"
> source(file)
However, it does not work if we do this from the shell prompt:
$ R --vanilla < Rscript.R
because the eval.parent statement attempts to access a "base workspace" that
does not contain the "file" object/varia
Darren Weber gmail.com> writes:
:
: Hi,
:
: if we have a file called Rscript.R that contains the following, for example:
:
: x <- 1:100
: outfile = "Rscript.Rout"
: sink(outfile)
: print(x)
:
: and then we run
:
: >> source("Rscript.R")
:
: we get an output file called Rscript.Rout - great!
Hi,
if we have a file called Rscript.R that contains the following, for example:
x <- 1:100
outfile = "Rscript.Rout"
sink(outfile)
print(x)
and then we run
>> source("Rscript.R")
we get an output file called Rscript.Rout - great!
Is there an internal variable, something like .Platform, that h