Hi all,

Forgive me if this question has been addressed, but I was unable to find 
anything in the r-help list or in cyberspace. My question is this: is there a 
function, or set of functions, that will enable a script to detect its own 
path? I have tried file.path() but that was not what I was looking for. It 
would be nice to be able to put all the related scripts I use in the same 
folder with a "master" script and then source() them in that "master" script. 
Problem is, the "master" script must first know where it is (without me having 
to open it and retype the path every time I move it).

Any ideas?
Stu

ps. I found this on the internet but a) I couldn't understand it, and b) it 
didn't work:

frame_files <- lapply(sys.frames(), function(x) x$ofile)
frame_files <- Filter(Negate(is.null), frame_files)
PATH <- dirname(frame_files[[length(frame_files)]])


~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Stu Field, PhD
Postdoctoral Fellow
Department of Biology
Colorado State University
1878 Campus Delivery
Fort Collins, CO 80523-1878
Office: E208 Anatomy/Zoology
Phone: (970) 491-5744
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~





        [[alternative HTML version deleted]]

______________________________________________
R-help@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.

Reply via email to