[R] How to see the implementation of print function for a class from a package?

R. Michael Weylandt michael.weylandt at gmail.com
Sun Jun 10 05:58:19 CEST 2012


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.



More information about the R-help mailing list