  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 that returns the full path of a R script?





On Mon, Oct 4, 2010 at 12:13 PM, Hadley Wickham <hadley@rice.edu> wrote:

> > 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] "c:/user/Desktop/"
> > so that regardless of where the script is, as long as the accompanying
> > scripts are in the same directory, they can be easily sourced with
> something
> > like:
> > dirX <- file.path.is.here("MasterScript.r")
> > source(paste(dirX, "AuxillaryFile.r", sep=""))
>
> If you use relative paths like so:
>
> # master.r
> source("AuxillaryFile.r")
>
> Then source("path/to/master.r", chdir = T) will work.  Mastering
> working directories is a much better idea than coming up with your own
> workarounds.
>
> Hadley
>
> --
> Assistant Professor / Dobelman Family Junior Chair
> Department of Statistics / Rice University
> http://had.co.nz/
>
> ______________________________________________
> 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.
>

	[[alternative HTML version deleted]]

