Skip to content

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

2 messages · Michael Kubovy, Frank E Harrell Jr

#
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/
#
Michael Kubovy wrote:
Michael - your e-mail is incomplete in a number of ways (output of 
typing "version", which package (Design), reference to documentation for 
function (type ?latex.anova.Design), reference to ?latex.default).  You 
can also check the code for latex.anova.Design to see what it will and 
won't do, and whether it's easy for you to change.  Improvements in the 
code are welcomed.

Frank