[R] get the scripname within the executed myscript.r

Ivan Calandra ivan.calandra at uni-hamburg.de
Tue Nov 2 11:12:27 CET 2010


Hi,

Not sure it would really help you since I haven't understood everything, 
but read
?list.files
the pattern argument is quite convenient too.

Ivan

Le 11/2/2010 10:47, Žroutík a écrit :
> Dear R-users!
>
> Is there a way to obtain the name of the executed myscript.r, i.e. when
>
> cmd>  rscript myscript.r
>
> is executed? (The name of the script in this case is "myscript.r")
>
> Here is the explanation of why I would like to get that: Why: I have
> prepared a set of scripts (decompose_data.r, plot_with_higher_resolution.r,
> plot_3D.r, etc.) placed in a root directory at one place. I keep updated
> only one original of each. For each new dataset, I create a new directory in
> my directory tree, and I copy r scripts with the same names containing a
> line for executing the only one, e.g.
>
> source(file.path("w:/data&  fits/root4scripts", "decompose_data.r"))
>
> This way I can execute old datasets with new/updated scripts automatically
> (by executing all decompose_data.r in the directory tree), or by copying new
> "links".r to the directory. A small inconvenience of this way of executing
> is, that ones named, it is hard to change the name of the script. Therefore
> I would like to introduce a function that reads the name of the scriptname
> executed somewhere deep in my directory tree and executes the proper
> script.r in the root. If anybody read till here, please: Is there a more
> convenient/straightforward way how manage more scripts through a directory
> tree with datasets and keeping them altogether updated?
>
> Thanks for listening, Zroutik
>
> 	[[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at r-project.org mailing list
> https://stat.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
> and provide commented, minimal, self-contained, reproducible code.
>

-- 
Ivan CALANDRA
PhD Student
University of Hamburg
Biozentrum Grindel und Zoologisches Museum
Abt. Säugetiere
Martin-Luther-King-Platz 3
D-20146 Hamburg, GERMANY
+49(0)40 42838 6231
ivan.calandra at uni-hamburg.de

**********
http://www.for771.uni-bonn.de
http://webapp5.rrz.uni-hamburg.de/mammals/eng/mitarbeiter.php



More information about the R-help mailing list