On Oct 26, 2010, at 2:59 PM, Ben Hunter wrote:
> Hi everyone,
>
> Why am I having such a tough time finding a way to put an mlogit summary
> table into latex? Everywhere I read says that using Sweave and latex is the
> most sophisticated, dynamic way to get output, but it appears very limited
> in this respect. I'm just starting out with Sweave and LaTeX and
I've only
> been working with R for about 5 months. I'm suspecting this is
something
> that just hasn't been done yet, but certainly there is a workaround I
don't
> know about. Hope so, anyway.
>
> Thanks a lot.
> Ben
Ben,
One thing to keep in mind is that the LaTeX related functions (save Sweave
itself) are contributed by folks via third party packages. They are not part of
the "core" R offering.
The two primary packages that offer LaTeX related output for common R objects
are xtable and Hmisc (via the latex() function). In both cases, the object class
methods that are included likely reflect, to a large extent, the most commonly
used R objects by the authors who are then motivated to write the functions. In
turn, these also tend to represent common usage more generally.
There may very well be someone out there who has created a specific function to
generate LaTeX output for the two functions of interest here, but they may not
have made them generally available for various reasons.
That being said, if you can take the relevant content of the R objects generated
by mlogit and/or multinom and construct a matrix or data frame from them, you
can then use the xtable() methods for a matrix or data frame to generate
formatted LaTeX output in your Sweave document. Since most relevant LaTeX output
is tabular in nature, using either a matrix or data frame is a general purpose
approach to getting the content you may desire, in lieu of having a method
specifically for a particular R object.
In addition, while this may not be a direction you wish to take, I did locate an
Export plug in for the Rcmdr package that appears to have some relevant
functionality for the summary.multinom() class. You may wish to consider that
approach. More information is at:
http://cran.r-project.org/web/packages/RcmdrPlugin.Export/
HTH,
Marc Schwartz