On Mar 15, 2013, at 12:33 PM, Simon Kiss wrote: > Hello: > I'm working with a 2-dimensional table that looks sort of like test below. > I'm trying to produce latex code that will add dimension names for both the > rows and the columns. > In using the following code, latex chokes when I include collabel='Vote' but > it's fine without it. > > The code below prouces the latex code further below. I'm confused by this, > because it looks like it's creating two bits of text for each instance of > \multicolumn. Is that really allowed in \multicolumn? > Could someone clarify? > Thank you! > Yours, SJK > > > library(Hmisc) > test<-as.table(matrix(c(50,50,50,50), ncol=2)) > latex(test, rowlabel='Gender',collabel='Vote', file='')
(This is more of a comment than an answer. I am only able to achieve part of what I think was your goal.) Since there is no argument to latex named 'collabel', I am guessing you may be getting partial name matching to `collabel.just`, and I doubt that 'Vote' is a valid argument for the Latex interpreter. `rowlabel` is supposed to be a column name in the 'object' argument. I'm not sure I can say what is supposed to happen when you give it a column name that is not in the object. I wasn't able to get the example in the help(latex) page to display rownames. I suspect you need to refer to the vignette: http://biostat.mc.vanderbilt.edu/wiki/pub/Main/StatReport/summary.pdf .... and I think you need the argument rowname rather than rowlabel > ww<- latex( test, rowname=c("E","F"), rgroup="Letters") > ww
file6b77a205c01.pdf
Description: Adobe PDF document
-- David. > > % latex.default(test, rowlabel = "Gender", collabel = "vote", file = "") > % > \begin{table}[!tbp] > \begin{center} > \begin{tabular}{lrr} > \hline\hline > \multicolumn{1}{l}{Gender}&\multicolumn{1}{vote}{A}&\multicolumn{1}{l}{B}\tabularnewline > \hline > A&$50$&$50$\tabularnewline > B&$50$&$50$\tabularnewline > \hline > \end{tabular} > \end{center} > \end{table} > ********************************* > Simon J. Kiss, PhD > Assistant Professor, Wilfrid Laurier University > 73 George Street > Brantford, Ontario, Canada > N3T 2C9 > Cell: +1 905 746 7606 > > Please avoid sending me Word, PowerPoint or Excel attachments. Sending these > documents puts pressure on many people to use Microsoft software and helps to > deny them any other choice. In effect, you become a buttress of the Microsoft > monopoly. > > To convert to plain text choose Text Only or Text Document as the Save As > Type. Your computer may also have a program to convert to PDF format. Select > File, then Print. Scroll through available printers and select the PDF > converter. Click on the Print button and enter a name for the PDF file when > requested. > > ______________________________________________ > 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 Alameda, CA, USA
______________________________________________ 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.