Method 2: Assigning row names to NULL In case, the row names are explicitly assigned to the rows, then using rownames(df) to NULL, deletes the row names and uses row numbers to access the rows.
To remove the row names or column names from a matrix, we just need to set them to NULL, in this way all the names will be nullified.
The default (is back compatible), FALSE , will signal an error, where NA will “automatic” row names and TRUE will call make.
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}
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With