[R-sig-Epi] stat.table object into latex

plummer at iarc.fr plummer at iarc.fr
Fri May 30 21:17:27 CEST 2008


I haven't thought about this before, but you are quite right: there
should be an xtable method for stat.table objects. I will make one
and hopefully this will be in the next release of Epi.

Martyn

Quoting albert sanchez niubo <albynew at hotmail.com>:

>
> Hello Lauri,
>
> If you write "> methods(xtable)", xtable.stat.table is not included, thus it
> must be included but I have not found howto...
>
> But, if you use:
> > a.latex <- latexVerbatim(a)
>
> Function latexVerbatim "executes the object's print method, capturing the
> output for a file inside a LaTeX verbatim environment" (as says in the help).
>
> While someone finds a better solution, I hope it can help you.
>
> Cheers,
> Albert
>
>
>
> Albert Sanchez-Niubo
> Drug abuse epidemiology
> IMIM-Hospital del Mar
> Parc de Recerca Biomèdica de Barcelona
> c/ Doctor Aiguader, 88 | 08003 Barcelona
> asanchez at imim.es
> www.imim.es
>
>
>
> > Date: Fri, 30 May 2008 09:46:57 +0300
> > From: lauri.nikkinen at iki.fi
> > To: r-sig-epi at stat.math.ethz.ch
> > Subject: [R-sig-Epi] stat.table object into latex
> >
> > R users,
> >
> > Is there a way to convert stat.table (library(Epi)) object into latex
> > table? I have tried xtable from (xtable package) and latex (Hmisc
> > package) with no success.
> >
> > Example code:
> >
> > install.packages("Epi")
> > library(Epi)
> > install.packages("Hmisc")
> > library(Hmisc)
> > install.packages("xtable")
> > library(xtable)
> >
> > a <- stat.table(index=list(wool,tension),
> >                 contents=list(count(),mean(breaks),percent (wool)),
> >                 data=warpbreaks)
> > a
> > a.latex <- xtable(a)
> > Error in UseMethod("xtable") : no applicable method for "xtable"
> > a.latex <- latex(a)
> > Error in x[, j] : incorrect number of dimensions
> >
> > Best,
> > Lauri
> >
> > _______________________________________________
> > R-sig-Epi at stat.math.ethz.ch mailing list
> > https://stat.ethz.ch/mailman/listinfo/r-sig-epi
>
> _________________________________________________________________
> La vida de los famosos al desnudo en MSN Entretenimiento
>
> 	[[alternative HTML version deleted]]
>
>



-----------------------------------------------------------------------
This message and its attachments are strictly confidenti...{{dropped:8}}



More information about the R-sig-Epi mailing list