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

From: Roger D. Peng <rpeng_at_jhsph.edu>
Date: Thu 07 Apr 2005 - 23:25:05 EST

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 get an output file called Rscript.Rout - great!
>
> Is there an internal variable, something like .Platform, that holds
> the script name when it is being executed? I would like to use that
> variable to define the output file name.
>
> Best, Darren
>
> ______________________________________________
> R-help@stat.math.ethz.ch mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html
>



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Thu Apr 07 23:29:35 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:31:03 EST