On Fri, 13 Jun 2003 20:13:02 +0700 Philippe Glaziou <[EMAIL PROTECTED]> wrote:
> 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 > I tried this on the latest version of Hmisc (1.6-0): library(Hmisc) set.seed(1) y <- factor(sample(c('a','b','c'),100,T)) x <- runif(100) a <- summary(y ~ x, method='reverse') options(digits=3) latex(a) and everything was fine. The following also worked: data(iris) a <- summary(Species~Sepal.Length, method='reverse',data=iris) latex(a) See if a bug fix in Hmisc has fixed your problem since the last time you updated the package. --- Frank E Harrell Jr Prof. of Biostatistics & Statistics Div. of Biostatistics & Epidem. Dept. of Health Evaluation Sciences U. Virginia School of Medicine http://hesweb1.med.virginia.edu/biostat ______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help