Remove data.frame row names when using xtable

Use include.rownames=FALSE in the print method.
See ?print.xtable:

R> print(xtable(res), include.rownames=FALSE)

% latex table generated in R 2.12.2 by xtable 1.5-6 package
% Fri Mar 25 10:06:08 2011
\begin{table}[ht]
\begin{center}
\begin{tabular}{rrrrr}
  \hline
am & cyl & mpg & hp & wt \\ 
  \hline
0.00 & 4.00 & 22.90 & 84.67 & 2.94 \\ 
  0.00 & 6.00 & 19.12 & 115.25 & 3.39 \\ 
  0.00 & 8.00 & 15.05 & 194.17 & 4.10 \\ 
  1.00 & 4.00 & 28.07 & 81.88 & 2.04 \\ 
  1.00 & 6.00 & 20.57 & 131.67 & 2.75 \\ 
  1.00 & 8.00 & 15.40 & 299.50 & 3.37 \\ 
   \hline
\end{tabular}
\end{center}
\end{table}

Leave a Comment