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 I call source("file1.R"),
it will run correctly. However, if I setwd to /files, then
call source("dir1/file1.R"), it will give an error when 
trying to source file2.R

Alberto Monteiro

______________________________________________
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
and provide commented, minimal, self-contained, reproducible code.

Reply via email to