我希望 xtable 不会覆盖我重复的行名条目。考虑以下 MWE:
> require(xtable)
> foo <- matrix(0, 2,2)
> rownames(foo) = rep("bar", 2)
> foo
[,1] [,2]
bar 0 0
bar 0 0
> xtable(foo)
% latex table generated in R 2.15.0 by xtable 1.7-0 package
% Fri Jun 22 13:59:36 2012
\begin{table}[ht]
\begin{center}
\begin{tabular}{rrr}
\hline
& 1 & 2 \\
\hline
1 & 0.00 & 0.00 \\
2 & 0.00 & 0.00 \\
\hline
\end{tabular}
\end{center}
\end{table}
Warning message:
In data.row.names(row.names, rowsi, i) :
some row.names duplicated: 2 --> row.names NOT used
我希望它们成为我原来的“bar”和“bar”,而不是让 rownames 成为 1 和 2。有没有办法覆盖 xtable 的重复替换方案?