According to this answer I can use include.rownames=FALSE
to suppress printing row names when using xtable
(package to convert r output to LaTeX table). E.g.:
Data:
> head(dataset)
order original prediction anomaly.score abs.o.p
1 1 0 0 1 0
2 2 0 0 1 0
3 3 0 0 1 0
4 4 0 0 0 0
5 5 0 0 0 0
6 6 0 0 0 0
Printing with row names:
> xtable(head(dataset))
% latex table generated in R 3.1.1 by xtable 1.8-0 package
% Sun Dec 20 18:38:13 2015
\begin{table}[ht]
\centering
\begin{tabular}{rrrrrr}
\hline
& order & original & prediction & anomaly.score & abs.o.p \\
\hline
1 & 1 & 0 & 0 & 1.00 & 0 \\
2 & 2 & 0 & 0 & 1.00 & 0 \\
3 & 3 & 0 & 0 & 1.00 & 0 \\
4 & 4 & 0 & 0 & 0.00 & 0 \\
5 & 5 & 0 & 0 & 0.00 & 0 \\
6 & 6 & 0 & 0 & 0.00 & 0 \\
\hline
\end{tabular}
\end{table}
Printing without row names:
> print(xtable(head(dataset)), include.rownames=FALSE)
% latex table generated in R 3.1.1 by xtable 1.8-0 package
% Sun Dec 20 18:49:34 2015
\begin{table}[ht]
\centering
\begin{tabular}{rrrrr}
\hline
order & original & prediction & anomaly.score & abs.o.p \\
\hline
1 & 0 & 0 & 1.00 & 0 \\
2 & 0 & 0 & 1.00 & 0 \\
3 & 0 & 0 & 1.00 & 0 \\
4 & 0 & 0 & 0.00 & 0 \\
5 & 0 & 0 & 0.00 & 0 \\
6 & 0 & 0 & 0.00 & 0 \\
\hline
\end{tabular}
\end{table}
As you can see include.rownames=FALSE
is argument for print
function not for xtable
. How is this possible? Isn't xtable
just printing the results to standard output? How does print
know what to omit when include.rownames=FALSE
is used? Referred page also mention ?print.xtable
. What does this mean? Is print.xtable
some special kind of print or it is xtable
method called from package print
or what is going on?