[R] xtable without rownames

Brian.J.GREGOR@odot.state.or.us Brian.J.GREGOR at odot.state.or.us
Thu May 13 18:13:20 CEST 2004


You can just set the rownames to an empty character string ("") and xtable
will work fine.

> -----Original Message-----
> From: Jeff D. Hamann [mailto:jeff.hamann at forestinformatics.com]
> Sent: Wednesday, May 12, 2004 5:40 PM
> To: r-help at stat.math.ethz.ch
> Subject: [R] xtable without rownames
> 
> 
> When I tried to read all the entries (after searching the 
> FAQ) for "row
> names xtable", I get
> 
> 
> START-INFO-DIR-ENTRY * R FAQ: (R-FAQ). The R statistical system ...
> ... xtable* Export data to LaTeX and HTML tables. ... For 
> dropping the row
> names of a matrix
> `x', it may be easier to use `rownames(x) <- NULL', similarly 
> for column ...
> cvs.r-project.org/cgi-bin/viewcvs.cgi/R/FAQ?rev=1.301 - 101k 
> - Supplemental
> Result - Cached - Similar pages
> I wasn't able to follow the link. I'd like to use xtable to 
> generate latex
> tables for using with Sweave and can't figure out how to not 
> include the row
> names. When I attempt to NULL out the row names using,
> 
> but cannot follow the links. Browser tells me the page is 
> unavailable. When
> I attempt to blank out the row names using,
> 
> rownames(summary.table) <- NULL
> 
> I get the following error
> 
> > rownames(rta) <- NULL
> Error in "dimnames<-.data.frame"(`*tmp*`, value = dn) :
>  invalid dimnames given for data frame
> >
> 
> the resulting (incorrect) table appears as,
> 
> > xtable( rta )
> % latex table generated in R 1.9.0 by xtable 1.2-2 package
> % Wed May 12 17:38:21 2004
> \begin{table}[ht]
> \begin{center}
> \begin{tabular}{rlr}
> \hline
>  & site.index & acres \\
> \hline
> 1 &  80 & 20.90 \\
> 2 &  90 & 64.42 \\
> ...blah, blah, blah...
> 8 & 150 & 53.32 \\
> 9 & 170 & 0.69 \\
> \hline
> \end{tabular}
> \end{center}
> \end{table}
> >
> 
> with the rownames. How do I get them out?
> 
> I'm stuck. Help.
> 
> Jeff.
> 
> ---
> Jeff D. Hamann
> Forest Informatics, Inc.
> PO Box 1421
> Corvallis, Oregon USA 97339-1421
> 541-754-1428
> jeff.hamann at forestinformatics.com
> www.forestinformatics.com
> 
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo/r-help
> PLEASE do read the posting guide! 
http://www.R-project.org/posting-guide.html




More information about the R-help mailing list