[R] Question about the rgroup option in Hmisc latex function

Ista Zahn izahn at psych.rochester.edu
Mon Dec 1 13:24:09 CET 2008


Is there a way to use the rgroup option without creating horizontal
rules separating the groups?

For example, say I have the following matrix containing sample sizes,
means, and standard deviations, for three groups of male and female
participants:

> descriptives
       n   Mean    SD
Male   "2" "0.703" "-0.809"
Female "3" "0.533" "-0.376"
Male   "2" "2.097" "-0.534"
Female "3" "0.843" " 0.966"
Male   "2" "0.350" " 0.149"
Female "3" "0.685" " 0.600"

I try typesetting the table with

> latex(descriptives, title="", file="", label="tab:descript", ctable=TRUE, caption="Means and standard deviations by condition and sex", colheads=c("Condition", "n", "Mean", "SD"), rgroup=c("One", "Two", "Three"))

which results in

\ctable[ caption={Means and standard deviations by condition and sex},
label=tab:descript, pos=!tbp, ]{llll} {}
{\FL\multicolumn{1}{l}{Condition}&
\multicolumn{1}{c}{n}&
\multicolumn{1}{c}{Mean}&
\multicolumn{1}{c}{SD}
\ML
{\bfseries One}&&&\NN
~~Male&2&0.703&-0.809\NN
~~Female&3&0.533&-0.376
\ML
{\bfseries Two}&&&\NN
~~Male&2&2.097&-0.534\NN
~~Female&3&0.843& 0.966
\ML
{\bfseries Three}&&&\NN
~~Male&2&0.350& 0.149\NN
~~Female&3&0.685& 0.600
\LL
}

but I want

\ctable[ caption={Means and standard deviations by condition and sex},
label=tab:descript, pos=!tbp, ]{llll} {}
{\FL\multicolumn{1}{l}{Condition}&
\multicolumn{1}{c}{n}&
\multicolumn{1}{c}{Mean}&
\multicolumn{1}{c}{SD}
\ML
{\bfseries One}&&&\NN
~~Male&2&0.703&-0.809\NN
~~Female&3&0.533&-0.376\NN
{\bfseries Two}&&&\NN
~~Male&2&2.097&-0.534\NN
~~Female&3&0.843& 0.966\NN
{\bfseries Three}&&&\NN
~~Male&2&0.350& 0.149\NN
~~Female&3&0.685& 0.600
\LL
}

i.e, I want the horizontal rules separating the row groups omitted.
Can this be done?

Thanks,
Ista



More information about the R-help mailing list