On Mon, 2006-05-01 at 17:21 -0400, Brian Quinif wrote:> Forgive my ignorance, but how I can take a look at the code for the
> latex function in the Hmisc library?
>
> I tried just typing "latex" but all I got was this:
>
> > latex
> function (object, title = first.word(deparse(substitute(object))),
> ...)
> {
> if (!length(oldClass(object)))
> oldClass(object) <- data.class(object)
> UseMethod("latex")
> }
>
> What should I do?
>
> Thanks,
>
> BQ
Brian,
latex() is the generic function, which in turn dispatches one of several
methods, based upon the class of the 'object' as the first argument.
To see the specific methods and thus the individual functions that are
actually called, use:
> methods(latex)
[1] latex.bystats latex.bystats2
[3] latex.default latex.describe
[5] latex.describe.single latex.function
[7] latex.list latex.summary.formula.cross
[9] latex.summary.formula.response latex.summary.formula.reverse
See ?methods
You can then use the above functions to see the code for the individual
methods as it exists within R. Note that this is not technically the
source code, which would be contained in the Hmisc tarball on CRAN. The
latter would have author comments and other content that will not appear
within the R session. However, the code as seen within R is more often
than not, sufficient to understand what is happening.
HTH,
Marc Schwartz