[R] Mathematical typesetting of column heads using the latex (Hmisc) function

Michael Kubovy kubovy at virginia.edu
Sun Feb 12 03:23:27 CET 2006


Dear r-helpers,

I would very much appreciate help with the following problem:

The following command (in a .Rnw file)

latex(anova(e7.lmer3, e7.lmer4), file = 'e7lmer34.tex', rowname = c 
('nonlinear', 'linear'), longtable = FALSE, dcolumn = T, booktabs =  
T, table.env = F)

produces the following output after running Sweave:

% latex.default(anova(e7.lmer1, e7.lmer2), file =  
"e7lmer12.tex",      rowname = c("nonlinear", "linear"), longtable =  
FALSE, dcolumn = T,      booktabs = T, table.env = F)
%
\newcolumntype{.}{D{.}{.}{-1}}
\begin{center}
\begin{tabular}{l.......}\toprule
\multicolumn{1}{l}{anova}&
\multicolumn{1}{c}{Df}&
\multicolumn{1}{c}{AIC}&
\multicolumn{1}{c}{BIC}&
\multicolumn{1}{c}{logLik}&
\multicolumn{1}{c}{Chisq}&
\multicolumn{1}{c}{Chi Df}&
\multicolumn{1}{c}{Pr(>Chisq)}
<snip>

I would like it to produce

\newcolumntype{.}{D{.}{.}{-1}}
\begin{center}
\begin{tabular}{l.......}\toprule
&
\multicolumn{1}{c}{d.f.}&
\multicolumn{1}{c}{\textsc{aic}}&
\multicolumn{1}{c}{\textsc{bic}}&
\multicolumn{1}{c}{$\log{(\mathcal{L})}$}&
\multicolumn{1}{c}{$\chi^{2}$}&
\multicolumn{1}{c}{\chi^{2}$ d.f.}&
\multicolumn{1}{c}{Pr($> \chi^{2}$)}
<snip>


_____________________________
Professor Michael Kubovy
University of Virginia
Department of Psychology
USPS:     P.O.Box 400400    Charlottesville, VA 22904-4400
Parcels:    Room 102        Gilmer Hall
         McCormick Road    Charlottesville, VA 22903
Office:    B011    +1-434-982-4729
Lab:        B019    +1-434-982-4751
Fax:        +1-434-982-4766
WWW:    http://www.people.virginia.edu/~mk9y/




More information about the R-help mailing list