Re: [R] Script auto-detecting its own path

2010-10-04 Thread Hadley Wickham
I'm not sure this will solve the issue because if I move the script, I would still have to go into the script and edit the /path/to/my/script.r, or do I misunderstand your workaround? I'm looking for something like: file.path.is.here(myscript.r) and which would return something like: [1]

Re: [R] Script auto-detecting its own path

2010-10-04 Thread steven mosher
in the package R.utils getAbsolutePath() or you can do a file.list(.. full.names=TRUE, recursive=TRUE,pattern=(.R)) the rest will require grep and pulling the file name and directory path apart If its not evident just ask and I'll write something for you. basically you want a call

Re: [R] Script auto-detecting its own path

2010-10-01 Thread Henrik Bengtsson
See findSourceTraceback() of R.utils, e.g. library(R.utils); example(findSourceTraceback); However, in general I would avoid using the above, because in nearly all cases there is a better solution which does not rely on knowing paths, e.g. setting up functions and calling those instead of using

Re: [R] Script auto-detecting its own path

2010-09-29 Thread Henrique Dallazuanna
Try this: PATH - dirname(sys.frame(1)$ofile) On Wed, Sep 29, 2010 at 5:00 PM, Stu Field s...@colostate.edu wrote: 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

Re: [R] Script auto-detecting its own path

2010-09-29 Thread Hadley Wickham
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

Re: [R] Script auto-detecting its own path

2010-09-29 Thread Stu Field
Hadley, I'm not sure this will solve the issue because if I move the script, I would still have to go into the script and edit the /path/to/my/script.r, or do I misunderstand your workaround? I'm looking for something like: file.path.is.here(myscript.r) and which would return something like: