Dieter Menne wrote:> Dear latexRs,
>
> I tried to make a latex printout of a simple categorial ftable. It should
> look like the output of print.ftable. Any ideas how to get the syntax of
> summary.formula right. Or some alternative? As far I see, xtable does not
> have method for ftable.
>
> Dieter
How about a Sweave approach? Something like this in the *.Rnw file:
\documentclass[letter]{article}
\begin{document}
@
<<echo=FALSE,print=FALSE>>
library(Hmisc)
n=500
sex <- factor(sample(c("m","f"), n, rep=TRUE))
treatment <- factor(sample(c("Drug","Placebo"), n,
rep=TRUE))
symptom <- factor(sample( c('H','S','G'), n,TRUE))
@
<<echo=TRUE,print=TRUE>>
ftable(symptom ~ treatment + sex)
@
\end{document}
Then Sweave() the *.Rnw file to produce a *.tex file in the working
directory.
> library(Hmisc)
> n=500
> sex <- factor(sample(c("m","f"), n, rep=TRUE))
> treatment <- factor(sample(c("Drug","Placebo"), n,
rep=TRUE))
> symptom <- factor(sample( c('H','S','G'),
n,TRUE))
> # I want this output in latex
> ftable(symptom~treatment+sex)
> # No, it's not the same
> ss = summary(symptom~treatment+sex,fun=table)
> latex(ss)
>
> ______________________________________________
> R-help at stat.math.ethz.ch 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.
--
Chuck Cleland, Ph.D.
NDRI, Inc.
71 West 23rd Street, 8th floor
New York, NY 10010
tel: (212) 845-4495 (Tu, Th)
tel: (732) 512-0171 (M, W, F)
fax: (917) 438-0894