[R] How do I obtain the current active path of a function that's being called?
Greg Snow
538280 at gmail.com
Tue Jun 5 23:35:31 CEST 2012
There are several ways that a function can come into being within R,
it can be sourced from a file like in your case, but it could also be
typed in by hand at the command prompt, or created by another
function, etc. So R does not in general keep links to the files from
which the file was generated. Some of the development programs for R
(such as rstudio) may keep track of this for you. Or you could put
some unique assignment at the start of each version of the function
then just look at the code for the function to see what that
assignment is. Unfortunately an R only general solution would need
ESP of some sort and my version of an esp package is still very
pre-alpha, it suggests "amply dromedary support effect damper
photogenic nonce" and unless that means something to you I don't think
it will be much help for a while. You will need to find a way to keep
track for yourself.
On Tue, Jun 5, 2012 at 2:58 PM, Michael <comtech.usa at gmail.com> wrote:
> Hi all,
>
> How do I obtain the current active path of a function that's being called?
>
> That's to say, I have several source files and they all contain definition
> of function A.
>
> I would like to figure out which function A and from which file is the one
> that's being called and is currently active?
>
> Thanks a lot!
>
> [[alternative HTML version deleted]]
>
> ______________________________________________
> R-help at 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.
--
Gregory (Greg) L. Snow Ph.D.
538280 at gmail.com
More information about the R-help
mailing list