. .
2011-Aug-31 01:12 UTC
[R] Hmisc Latex Question: column headings and Major Column Headings not properly alligned
Dear R users: When I create a table without Major Column headings, my *regular* column headings appear correct in the typeset latex file. The major row heading and row groups are as they should. w <- latex(mytab,title="",file="tab/my.tex",ctable=TRUE,caption="Descriptive statistics by Covariate",caption.loc="bottom",label="tab:mytab",where="!htbp",n.rgroup=c(3,3),rgroup=c("Type I","Type II")) However, I'm trying to use cgroup and n.cgroup to group my columns under appropriate heading as: w <- latex(mytab,title="",file="tab/mytab.tex",ctable=TRUE,caption="Descriptive statistics by Covariate",caption.loc="bottom",label="tab:mytab",where="!htbp",n.rgroup=c(3,3),rgroup=c("Type I","Type II"),n.cgroup=c(2,2,2,2,1),cgroup=c("Type A","Type B","Type C","Type D","n"),rowlabel="",size="scriptsize") When I use this code (there are 9 columns total in R object "mytab") the resulting Major Column headings are typeset properly, however the colheads themselves are missaligned. The first column heading is over the row labels (Type I and Type II), and the rest of the column headings are spaced offset to the major column headings, so don't line up underneath. I've searched through google and haven't found anything, and I've been experimenting with every combination of latex() options I can think of, and nothing is working. Any suggestions/solutions are greatly appreciated! My Hmisc version is: 3.8-3 and R version is: 2.8.1 [[alternative HTML version deleted]]
. .
2011-Aug-31 02:13 UTC
[R] Hmisc Latex Question: column headings and Major Column Headings not properly alligned
By way of follow-up, here is some data and code that generates the output with headings out of alignment:> dput(mytab)structure(c(1.3878, -0.7194, 0.3235, 1.6316, -0.4356, 1.8148, 2.1689, -1.3665, -0.2746, -0.5798, 0.7115, -0.1848, -0.2882, -1.2555, 1.0218, -1.0525, 0.0228, -0.4127, -0.1542, 0.6117, -1.3412, 0.5571, -0.3136, -1.0425, 0.1988, 0.4753, -1.1376, 1.4776, 0.3341, 0.3023, 0.9131, 0.0879, 1.0132, -0.2998, 1.957, 0.6771, 0.3905, 0.55, 0.2163, -0.2591, -1.6511, 2.2718, 0.2844, 0.7738, 0.5144, 0.3111, -0.1829, -1.3218, 0.3496, -0.9592, -0.5241, -2.4456, -0.0152, 0.9551), .Dim = c(6L, 9L), .Dimnames = list(c("1a", "1b", "Overall", "2a", "2b", "Overall"), c("mean", "sd", "mean", "sd", "mean", "sd", "mean", "sd", "n")))>Code: w <- latex(mytab,title="",file="tab/mytab.tex",ctable=TRUE,caption="Descriptive statistic by Covariate",caption.loc="bottom",label="tab:sumtab",where="!htbp",n.rgroup=c(3,3),rgroup=c("Type I","Type II"),size="scriptsize",n.cgroup=c(2,2,2,2,1),cgroup=c("Type A","Type B","Type C","Type D","N")) Thank-you again-> From: dwinsemius@comcast.net > To: stats09@hotmail.com > Subject: Re: [R] Hmisc Latex Question: column headings and Major Column Headings not properly alligned > Date: Tue, 30 Aug 2011 21:23:41 -0400 > > May I suggest you post to the list the output of dput(mytab) ? > > If Frank can see immediately what the problem is, he may come along > in a day or two, but he usually wants a working example. > > -- > David. > > > On Aug 30, 2011, at 9:12 PM, . . wrote: > > > > > Dear R users: > > > > When I create a table without Major Column headings, my *regular* > > column headings appear correct in the typeset latex file. The major > > row heading and row groups are as they should. > > > > w <- latex(mytab,title="",file="tab/ > > my.tex",ctable=TRUE,caption="Descriptive statistics by > > Covariate",caption.loc="bottom",label="tab:mytab",where="! > > htbp",n.rgroup=c(3,3),rgroup=c("Type I","Type II")) > > > > However, I'm trying to use cgroup and n.cgroup to group my columns > > under appropriate heading as: > > > > w <- latex(mytab,title="",file="tab/ > > mytab.tex",ctable=TRUE,caption="Descriptive statistics by > > Covariate",caption.loc="bottom",label="tab:mytab",where="! > > htbp",n.rgroup=c(3,3),rgroup=c("Type I","Type > > II"),n.cgroup=c(2,2,2,2,1),cgroup=c("Type A","Type B","Type C","Type > > D","n"),rowlabel="",size="scriptsize") > > > > When I use this code (there are 9 columns total in R object "mytab") > > the resulting Major Column headings are typeset properly, however > > the colheads themselves are missaligned. The first column heading > > is over the row labels (Type I and Type II), and the rest of the > > column headings are spaced offset to the major column headings, so > > don't line up underneath. > > > > I've searched through google and haven't found anything, and I've > > been experimenting with every combination of latex() options I can > > think of, and nothing is working. Any suggestions/solutions are > > greatly appreciated! > > > > My Hmisc version is: 3.8-3 > > and R version is: 2.8.1 > > > > > > > > [[alternative HTML version deleted]] > > > > ______________________________________________ > > R-help@r-project.org mailing list > > https://stat.ethz.ch/mailman/listinfo/r-help > > PLEASE do read the posting guide http://www.R-project.org/posting-guide.html > > and provide commented, minimal, self-contained, reproducible code. > > David Winsemius, MD > West Hartford, CT >[[alternative HTML version deleted]]