1

When debugging a function, R displays the full filename from where the function was sourced. Example output shown below.

Where is this information (filename) stored and is it user accessible?

    > debugonce(myFunction)
    > myFunction(x)
    debugging in: myFunction(x)
    debug at /path/to/filename.r#41: {

        < body of myFunction >
    }
    Browse[2]> Q
    > 
Mogsdad
  • 44,709
  • 21
  • 151
  • 275
Ricardo Saporta
  • 54,400
  • 17
  • 144
  • 178
  • Look at the answer to this question: http://stackoverflow.com/questions/24546356/r-logging-display-name-of-the-script/24546885#24546885 and check out the `?getSrcFilename` function. – MrFlick Sep 04 '14 at 18:25
  • Interesting... it's an attribute on the attribute. Thanks Señor Flick – Ricardo Saporta Sep 04 '14 at 18:57

1 Answers1

0

There are attributes on the attribute srcref of the function. One of those is srcfile

 attr(attr(myFunc, "srcref"), "srcfile")

 or
 getSrcFilename(myFunc)

Thanks to @MrFlick

Ricardo Saporta
  • 54,400
  • 17
  • 144
  • 178