[R] How do I obtain the current active path of a function that's being called?

Bert Gunter gunter.berton at gene.com
Wed Jun 6 07:15:05 CEST 2012


See also ?trace ,?debugger, ?traceback and links therein.

-- Bert

On Tue, Jun 5, 2012 at 9:48 PM, Greg Snow <538280 at gmail.com> wrote:
> You can use the debug, fix, or edit functions to insert break points
> into the version of the function in memory without needing to edit the
> original source code.
>
> On Tue, Jun 5, 2012 at 5:51 PM, Michael <comtech.usa at gmail.com> wrote:
>> Thanks so much for your help!
>>
>> I'd like but however I couldn't provide the code since they are not in
>> public domain...
>>
>> But lets imagine I inherited a big pile of R projects/codes from other
>> people and there are lots of "source"s in the programs.
>>
>> And there are many definitions of function "A" in the directories.
>>
>> I wanted to put a breakpoint into the relavant function "A" that's
>> currently in the workspace, i.e. the one I am using...
>>
>> To insert a breakpoint, I need to find its location in the file system... I
>> need to find where it is...
>>
>> Simply searching by the name in the file system gave lots of hits...
>>
>> Thank you!
>>
>> On Tue, Jun 5, 2012 at 4:35 PM, Andrew Miles <rstuff.miles at gmail.com> wrote:
>>
>>> Can you provide an example of the code file that you use to call the
>>> different functions?  Without that it might be hard for people to answer
>>> your question.
>>>
>>> Offhand, I'd say that it is whatever version of function A was called
>>> last.  If you are loading functions into the workspace, they are treated as
>>> any other object, which is to say that you can only have one function of
>>> the same name at a time.  Hence whenever you call a source file to load in
>>> function A, the old function A gets overwritten.
>>>
>>> Andrew Miles
>>>
>>>
>>> On Jun 5, 2012, at 4:58 PM, Michael 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<http://www.r-project.org/posting-guide.html>
>>> > and provide commented, minimal, self-contained, reproducible code.
>>>
>>>
>>
>>        [[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
>
> ______________________________________________
> 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.



-- 

Bert Gunter
Genentech Nonclinical Biostatistics

Internal Contact Info:
Phone: 467-7374
Website:
http://pharmadevelopment.roche.com/index/pdb/pdb-functional-groups/pdb-biostatistics/pdb-ncb-home.htm



More information about the R-help mailing list