raymondowf
2011-Mar-09 09:19 UTC
[R] Getting the source file's name where the custom function is written
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.
Ivan Calandra
2011-Mar-09 09:41 UTC
[R] Getting the source file's name where the custom function is written
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 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. >-- 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.calandra at uni-hamburg.de ********** http://www.for771.uni-bonn.de http://webapp5.rrz.uni-hamburg.de/mammals/eng/1525_8_1.php
Reasonably Related Threads
- OOP and passing by value
- [LLVMdev] Assertion `castIsValid(getOpcode(), S, Ty) && "Illegal BitCast"' failed.
- SHELL() function Asterisk 13 - can only accept one paramter in string?
- [LLVMdev] Assertion `InReg && "Value not in map!"' failed
- [LLVMdev] Assertion `InReg && "Value not in map!"' failed