[R] problem with latex of object summary reverse
Philippe Glaziou
glaziou at pasteur-kh.org
Fri Jun 13 15:13:02 CEST 2003
Hi,
I have the following problem (library Hmisc loaded,
iris data loaded, R Version 1.7.0 (2003-04-16), packages
updated, running on a linux Debian i386):
> summary(Species~Sepal.Length,method="reverse")->a
> a
Descriptive Statistics by Species
+------------+-----------------+-----------------+-----------------+
| |setosa |versicolor |virginica
|
| |(N=50) |(N=50) |(N=50)
|
+------------+-----------------+-----------------+-----------------+
|Sepal.Length|4.800/5.000/5.200|5.600/5.900/6.300|6.225/6.500/6.900|
+------------+-----------------+-----------------+-----------------+
> latex(a)->la
works ok, but the a.tex generated file is wrong: a '&' is
missing on the line ending with '%%%% wrong', resulting in the
(N=50) of the second row being put on the first column, like:
+------------+-----------------+-----------------+-----------------+
| |setosa |versicolor |virginica
|
|(N=50) |(N=50) |(N=50) |
|
+------------+-----------------+-----------------+-----------------+
|Sepal.Length|4.800/5.000/5.200|5.600/5.900/6.300|6.225/6.500/6.900|
+------------+-----------------+-----------------+-----------------+
> system("cat a.tex")
% latex.default(cstats, title = title, caption = caption,
rowlabel = rowlabel, col.just = col.just,
numeric.dollar = FALSE, insert.bottom = legend, rowname
= lab, dcolumn = dcolumn, extracolheads = extracolheads,
extracolsize = Nsize, ...)
%
\begin{table}[!tbp]
\begin{center}
\caption{Descriptive Statistics by Species\label{a}}
\begin{tabular}{lccc}\hline\hline
\multicolumn{1}{l}{}&
\multicolumn{1}{c}{setosa}&
\multicolumn{1}{c}{versicolor}&
\multicolumn{1}{c}{virginica}
\\ \multicolumn{1}{l}{{\scriptsize %%%% wrong
$N=50$}}&\multicolumn{1}{c}{{\scriptsize
$N=50$}}&\multicolumn{1}{c}{{\scriptsize $N=50$}}\\ \hline
Sepal.Length&{\scriptsize 4.800~}{5.000 }{\scriptsize 5.200}
&{\scriptsize 5.600~}{5.900 }{\scriptsize 6.300}
&{\scriptsize 6.225~}{6.500 }{\scriptsize 6.900} \\
[...]
Any idea about what I might be doing wrong here? I can
reproduce that problem with summary(method="reverse") on
other datasets, and various combinations of options passed
to the latex command.
Thanks
--
Philippe
More information about the R-help
mailing list