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

2012-06-07 Thread Duncan Murdoch

On 12-06-05 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?


You've had lots of good suggestions so far.  One more possibility:

getSrcFilename

and the related functions in the same help topic will usually tell you 
the filename and other location information for functions that you 
source().


Duncan Murdoch

__
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.


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

2012-06-07 Thread Greg Snow
Wow, even those of us who have been using S for more than 25 years
(and R since well before version 1.0) still have things to learn since
R keeps improving.  So I stand corrected (well sit actually) on the
part about not keeping track of this sort of thing.

On Thu, Jun 7, 2012 at 3:04 AM, Duncan Murdoch murdoch.dun...@gmail.com wrote:
 On 12-06-05 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?


 You've had lots of good suggestions so far.  One more possibility:

 getSrcFilename

 and the related functions in the same help topic will usually tell you the
 filename and other location information for functions that you source().

 Duncan Murdoch


 __
 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.



-- 
Gregory (Greg) L. Snow Ph.D.
538...@gmail.com

__
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.


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

2012-06-06 Thread Gabor Grothendieck
On Tue, Jun 5, 2012 at 4:58 PM, Michael comtech@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?


Here are a few possibilities:

1. In each source file add this line:

this.file - sys.frame(1)$ofile

Then if you do this:

source(a.R)

the variable this.file will be left in your global environment so you
can find out what your last file read in was.

A slightly more sophisticated version creates a stack of file names:

if (!exists(this.file)) this.file - NULL
this.file - unique(c(sys.frame(1)$ofile, this.file))

This is a bit of a hack.  If the internals of source change then  you
will have to change this code in a corresponding manner.

2. source each file into a separate environment.

source(a.R, local = a - new.env(parent = .GlobalEnv))
# if f is a function in a.R then call it like this:
a$f(...whatever...)

Be sure you source each file into a different environment.

3. In the source file a.R write each function like this:

f - function()
# a.R
{
...whatever...
}

Then as.character(attr(f, srcfile))[2] will show the comment.  Be
sure that getOption(keep.source) is TRUE (normally it is) or if its
not feasible to arrange that then set it in each source call:

source(a.R, keep.source = TRUE)

4. put your functions in packages.  search() will show the packages
you have loaded in order.

-- 
Statistics  Software Consulting
GKX Group, GKX Associates Inc.
tel: 1-877-GKX-GROUP
email: ggrothendieck at gmail.com

__
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.


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

2012-06-05 Thread Michael
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@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.


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

2012-06-05 Thread Greg Snow
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@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@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.
538...@gmail.com

__
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.


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

2012-06-05 Thread Andrew Miles
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@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.

__
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.


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

2012-06-05 Thread Michael
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 sources 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.mi...@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@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.htmlhttp://www.r-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.



[[alternative HTML version deleted]]

__
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.


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

2012-06-05 Thread David Winsemius


On Jun 5, 2012, at 7:51 PM, Michael 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 sources 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...


You could go through and label each of the `A` functions with a  
comment that designated the file from which they were loaded.


 func - function() x
 comment(func) - test
 comment(func)
[1] test

--
David.



Thank you!

On Tue, Jun 5, 2012 at 4:35 PM, Andrew Miles  
rstuff.mi...@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@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.htmlhttp://www.r-project.org/posting-guide.html 


and provide commented, minimal, self-contained, reproducible code.





[[alternative HTML version deleted]]

__
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.


David Winsemius, MD
West Hartford, CT

__
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.


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

2012-06-05 Thread Richard M. Heiberger
I think your best option is to invest time in learning how to build an R
package, and then
package each project.  Conflicting names are not a problem when you have
them inside package
namespaces.  See the extensions document in R in the R distribution
R-2.15.0/doc/manual/R-exts.html

One way to handle breakpoints is with the ess-tracebug function inside ESS
inside emacs
http://code.google.com/p/ess-tracebug/
http://ess.r-project.org/
The
http://biostat.mc.vanderbilt.edu/wiki/Main/UseR-2012
conference is next week in Nashville.

We have a tutorial on ESS, which will include an introduction to
ess-tracebug, on Tuesday morning.

Rich
On Tue, Jun 5, 2012 at 8:12 PM, David Winsemius dwinsem...@comcast.netwrote:


 On Jun 5, 2012, at 7:51 PM, Michael 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 sources 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...


 You could go through and label each of the `A` functions with a comment
 that designated the file from which they were loaded.

  func - function() x
  comment(func) - test
  comment(func)
 [1] test

 --
 David.



 Thank you!

 On Tue, Jun 5, 2012 at 4:35 PM, Andrew Miles rstuff.mi...@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@r-project.org mailing list
 https://stat.ethz.ch/mailman/**listinfo/r-helphttps://stat.ethz.ch/mailman/listinfo/r-help
 PLEASE do read the posting guide

 http://www.R-project.org/**posting-guide.htmlhttp://www.r-project.org/posting-guide.html
 http://www.**r-project.org/posting-guide.**htmlhttp://www.r-project.org/posting-guide.html
 

 and provide commented, minimal, self-contained, reproducible code.




[[alternative HTML version deleted]]

 __**
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/**listinfo/r-helphttps://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.


 David Winsemius, MD
 West Hartford, CT


 __**
 R-help@r-project.org mailing list
 https://stat.ethz.ch/mailman/**listinfo/r-helphttps://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@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.


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

2012-06-05 Thread David Winsemius


On Jun 5, 2012, at 8:35 PM, arun wrote:




Hi Dave,

I am interested in your suggestion.  But, look at this scenario.

func-function()x
comment(func)-test
comment(func)

[1] test


func-function()y
comment(func)-test2
comment(func)

[1] test2

func-function()x
comment(func)

NULL

func-function()y
comment(func)

NULL


Does it imply that it needs different objects?
Thanks,


I think it implies that I had one beer too many.

--  
David.


- Original Message -
From: David Winsemius dwinsem...@comcast.net
To: Michael comtech@gmail.com
Cc: r-help r-h...@stat.math.ethz.ch
Sent: Tuesday, June 5, 2012 8:12 PM
Subject: Re: [R] How do I obtain the current active path of a  
function that's being called?



On Jun 5, 2012, at 7:51 PM, Michael 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 sources 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...


You could go through and label each of the `A` functions with a  
comment that designated the file from which they were loaded.



func - function() x
comment(func) - test
comment(func)

[1] test

--David.



Thank you!

On Tue, Jun 5, 2012 at 4:35 PM, Andrew Miles  
rstuff.mi...@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@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.htmlhttp://www.r-project.org/posting-guide.html 


and provide commented, minimal, self-contained, reproducible code.





[[alternative HTML version deleted]]

__
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.


David Winsemius, MD
West Hartford, CT

__
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.



David Winsemius, MD
West Hartford, CT

__
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.


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

2012-06-05 Thread arun


Hi Dave,

I am interested in your suggestion.  But, look at this scenario.
 func-function()x
 comment(func)-test
 comment(func)
[1] test

 func-function()y
 comment(func)-test2
 comment(func)
[1] test2
 func-function()x
 comment(func)
NULL
 func-function()y
 comment(func)
NULL


Does it imply that it needs different objects?
Thanks,


A.K







- Original Message -
From: David Winsemius dwinsem...@comcast.net
To: Michael comtech@gmail.com
Cc: r-help r-h...@stat.math.ethz.ch
Sent: Tuesday, June 5, 2012 8:12 PM
Subject: Re: [R] How do I obtain the current active path of a function that's 
being called?


On Jun 5, 2012, at 7:51 PM, Michael 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 sources 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...

You could go through and label each of the `A` functions with a comment that 
designated the file from which they were loaded.

 func - function() x
 comment(func) - test
 comment(func)
[1] test

--David.

 
 Thank you!
 
 On Tue, Jun 5, 2012 at 4:35 PM, Andrew Miles rstuff.mi...@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@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.htmlhttp://www.r-project.org/posting-guide.html
 and provide commented, minimal, self-contained, reproducible code.
 
 
 
     [[alternative HTML version deleted]]
 
 __
 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.

David Winsemius, MD
West Hartford, CT

__
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.


__
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.


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

2012-06-05 Thread Greg Snow
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@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 sources 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.mi...@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@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.htmlhttp://www.r-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.



        [[alternative HTML version deleted]]

 __
 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.



-- 
Gregory (Greg) L. Snow Ph.D.
538...@gmail.com

__
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.


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

2012-06-05 Thread Bert Gunter
See also ?trace ,?debugger, ?traceback and links therein.

-- Bert

On Tue, Jun 5, 2012 at 9:48 PM, Greg Snow 538...@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@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 sources 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.mi...@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@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.htmlhttp://www.r-project.org/posting-guide.html
  and provide commented, minimal, self-contained, reproducible code.



        [[alternative HTML version deleted]]

 __
 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.



 --
 Gregory (Greg) L. Snow Ph.D.
 538...@gmail.com

 __
 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.



-- 

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

__
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.