[R] file path

Gabor Grothendieck ggrothendieck at gmail.com
Wed Feb 21 18:51:42 CET 2007


Its not clear from your post what the framework is that you are working with
but assuming that you have sourced a file and want its name place this

   fn <- parent.frame(2)$ofile
   # other code

in a file a.R, say, and from within R source it:

  source("a.R")

This is not very safe and could easily have to be changed from one version
of R to the next if source() is changed since it makes use of internals
within source().

On 2/21/07, Rita Sousa <rita.sousa at ine.pt> wrote:
> Hello,
>
>
>
> It is possible to return the path of the current working R-file (in
> execution)?
>
>
>
> Thanks,
>
> Rita Sousa.
>
>
>        [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.
>



More information about the R-help mailing list