Re: Fwd: [R] Is a .R script file name available inside the script?

2005-04-09 Thread Uwe Ligges
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,

Fwd: [R] Is a .R script file name available inside the script?

2005-04-08 Thread Darren Weber
-- 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

Re: [R] Is a .R script file name available inside the script?

2005-04-07 Thread Roger D. Peng
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

Re: [R] Is a .R script file name available inside the script?

2005-04-06 Thread Gabor Grothendieck
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

Re: [R] Is a .R script file name available inside the script?

2005-04-06 Thread Darren Weber
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

Re: [R] Is a .R script file name available inside the script?

2005-03-18 Thread Gabor Grothendieck
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!

[R] Is a .R script file name available inside the script?

2005-03-18 Thread Darren Weber
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