Majid Einian
2012-Jun-10 03:53 UTC
[R] How to see the implementation of print function for a class from a package?
Dear R-helpers, I want to see the code used when printing (using print(object) or by just typing the object name) for a class from a package. I can see the summary code using packagename::summary.classname but nothing for print method and also plot methods. In general, how can I see the COMPLETE code for a package? not just the function defs? -- Majid Einian, PhD Candidate in "Economics", Graduate School of Management and Economics, Sharif University of Technology, Tehran, IRAN [[alternative HTML version deleted]]
R. Michael Weylandt
2012-Jun-10 03:58 UTC
[R] How to see the implementation of print function for a class from a package?
I presume your problem is that you are looking for non-exported methods in some unstated package. Generally the pattern is something like this methods(plot) # shows all plot.* methods methods(class = "lm") # shows all *.lm methods Those marked with a star are not exported but you can get at them with the getAnywhere() function [you can also use three colons instead of two, but that requires you to know the function at hand] Incidentally, you might also want to download the package source from CRAN and browse it to see the author's commented code. Michael On Sat, Jun 9, 2012 at 10:53 PM, Majid Einian <einian85 at gmail.com> wrote:> Dear R-helpers, > I want to see the code used when printing (using print(object) or by just > typing the object name) for a class from a package. > I can see the summary code using packagename::summary.classname but nothing > for print method and also plot methods. > > In general, how can I see the COMPLETE code for a package? not just the > function defs? > > -- > Majid Einian, > PhD Candidate in "Economics", > Graduate School of Management and Economics, > Sharif University of Technology, > Tehran, IRAN > > ? ? ? ?[[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.