Firstly, some layout data:
x <- sample(LETTERS, 5, replace = TRUE) y <- sample(LETTERS, 5, replace = TRUE) z <- table(x, y)
Now here are some awkward solutions using the print.xtable add.to.row argument.
comment <- list() comment$pos <- list() comment$pos[[1]] <- c(nrow(z)) comment$command <- c(paste("\\hline \n",
If you want your comment to be placed before the data, use comment$pos[[1]] <- c(0) instead of comment$pos[[1]] <- c(nrow(z)) and configure hline.after .
Here is my conclusion:
% latex table generated in R 2.14.1 by xtable 1.7-0 package % Mon Feb 20 02:17:58 2012 \begin{table}[ht] \begin{center} \begin{tabular}{rrrrr} \hline & B & C & P & V \\ \hline A & 0 & 0 & 0 & 1 \\ D & 1 & 0 & 0 & 0 \\ I & 0 & 0 & 0 & 1 \\ P & 0 & 0 & 1 & 0 \\ Z & 0 & 1 & 0 & 0 \\ \hline your footnote, caption or whatever. \end{tabular} \end{center} \end{table} xtable 1.7-0 package % latex table generated in R 2.14.1 by xtable 1.7-0 package % Mon Feb 20 02:17:58 2012 \begin{table}[ht] \begin{center} \begin{tabular}{rrrrr} \hline & B & C & P & V \\ \hline A & 0 & 0 & 0 & 1 \\ D & 1 & 0 & 0 & 0 \\ I & 0 & 0 & 0 & 1 \\ P & 0 & 0 & 1 & 0 \\ Z & 0 & 1 & 0 & 0 \\ \hline your footnote, caption or whatever. \end{tabular} \end{center} \end{table}
source share