[R] Source inside source

2007-07-16 Thread Alberto Monteiro
Is there a way to know where is the source, so as to make a source call inside another source smarter? As an example: file1.R is in directory /files/dir1/ file2.R is in directory /files/dir1/dir2/ In file1.R, there is this line: source(dir2/file2.R) So, if I setwd to /files/dir1/, and then

Re: [R] Source inside source

2007-07-16 Thread Benilton Carvalho
the smarter thing is to write a package, so you don't need source() at all. but your problem will be fixed if you use the full path instead: source(/home/user/dir1/dir2/file2.R) (and obviously you could pass the path as an argument to whatever function you're using...) b On Jul 16, 2007,

Re: [R] Source inside source

2007-07-16 Thread Duncan Temple Lang
There is a package available at http://www.omegahat.org/Prerelease/RSource_0.1-1.tar.gz that has an extended source() that maintains a list of directories in which to search for files and a stack of the files currently being source()d so that one can determine what is currently going on. It