Hi,

There might be better solution, but I think this works (got it by searching "source function" with RSiteSearch()):
attr(body(myPrint), "srcfile")

Here is the original answer:
http://finzi.psych.upenn.edu/Rhelp10/2010-February/227805.html

HTH,
Ivan

Le 3/9/2011 10:19, raymondowf a écrit :
Dear R experts,
  I've written some functions in a few source files (such as main.R,
control.R ...).
  After loading them into R, how do I retrieve which functions are loaded
from which source file?

  For example:
  main.R has functions:   myPrint(), myScan()
  control.R has functions: setPrinter(), setData()

  After loading the sources (main.R and control.R) into R, I would want to
know that myPrint() and myScan are from main.R while the rest from control.R

Many thanks!!!

--
View this message in context: 
http://r.789695.n4.nabble.com/Getting-the-source-file-s-name-where-the-custom-function-is-written-tp3343135p3343135.html
Sent from the R help mailing list archive at Nabble.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.


--
Ivan CALANDRA
PhD Student
University of Hamburg
Biozentrum Grindel und Zoologisches Museum
Abt. Säugetiere
Martin-Luther-King-Platz 3
D-20146 Hamburg, GERMANY
+49(0)40 42838 6231
ivan.calan...@uni-hamburg.de

**********
http://www.for771.uni-bonn.de
http://webapp5.rrz.uni-hamburg.de/mammals/eng/1525_8_1.php

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

Reply via email to