出力にディメンションのラベルを付けたいのですがxtable
。ただし、のtableメソッドは、手動で次xtable
のように指定してもディメンションラベルを出力しません。table
set.seed(10)
d <- data.frame(x=sample(1:4),y=sample(1:4))
tb <- with(d, table(d,dnn=c("Xs","Ys")))
> tb
Ys
Xs 1 2 3 4
1 0 0 0 1
2 0 1 0 0
3 1 0 0 0
4 0 0 1 0
> xtable(tb)
% latex table generated in R 2.15.1 by xtable 1.7-0 package
% Tue Oct 9 09:06:10 2012
\begin{table}[ht]
\begin{center}
\begin{tabular}{rrrrr}
\hline
& 1 & 2 & 3 & 4 \\
\hline
1 & 0 & 0 & 0 & 1 \\
2 & 0 & 1 & 0 & 0 \\
3 & 1 & 0 & 0 & 0 \\
4 & 0 & 0 & 1 & 0 \\
\hline
\end{tabular}
\end{center}
\end{table}
のコードを調べてxtable.table
も、秘密は見つかりません。複数行を使用して手動で構築する以外に、ディメンションにラベルを付ける方法はありますか?