[R] retrieving name of a function inside this function
Duncan Murdoch
murdoch.duncan at gmail.com
Wed Jun 1 13:44:01 CEST 2011
On 11-06-01 7:26 AM, Jannis wrote:
> Dear list members,
>
>
> is it possible to retrieve the name of a function or the exact call to that function from the environment created "inside" this function? I wrote a function for debugging on a cluster that saves all the objects inside the whole stack of function environments and would also like to retrieve the names of the respective functions. Perhaps also a method to simply retrieve the name of a function inside this function could give me hints to the solution.
I'm not sure I understand what you're asking, but I think the answer is
no. You can retrieve the name of a function by calling sys.call() (or a
related function for more information, see ?sys.call), but that has to
be called in the context of the function. The information is not stored
in the active environment, you'll need to save more than that. I think
sys.calls() will give you the information you need.
Duncan Murdoch
> Thanks
> Jannis
>
> ______________________________________________
> 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.
More information about the R-help
mailing list