title: xtable output for a list of tables
body: <p>I've a list of tables and want to sweave it for LaTex output. Here is the code:</p>
  
  <pre><code>Data &lt;- esoph[ , 1:3]
  library(plyr)
  combos &lt;- combn(ncol(Data),2)
  
  TabelFn &lt;- function(x) {
    Table &lt;- addmargins(table(Data[, x[1]], Data[, x[2]]))
    return(Table)
    }
  
  Table &lt;- alply(.data=combos, .margins=2, .fun=TabelFn, .expand=TRUE)
  library(xtable)
  </code></pre>
  
  <p>The list <code>Table</code> has three contingency tables in this case and I can sweave the output to LaTex using this code:</p>
  
  <pre><code>&lt;&lt; label = tabTable, echo = FALSE, results = tex &gt;&gt;=
  print(xtable(Table[1]$'1', caption = "Contingency table for agegp and alcgp", label = "tab:Table[1]",
               digits = c(0, rep(0, ncol(Table[1]$'1'))),
               align = paste(paste("l|", paste(rep("r", ncol(Table[1]$'1')-1), collapse =     ''), sep = ""), "l", sep = "")),
        table.placement = "tbp", caption.placement = "top",
        hline.after = c(-1, 0, nrow(Table[1]$'1')))
  @
  </code></pre>
  
  <p>To send the output of three contingency tables I've to write three such commands. In this case it is feasible. But for my actual data I've many contingency tables. I'd like to know how to send all contingency tables more efficiently. One choice is to just print the list <code>Table</code> without <code>xtable</code>. But I'd like to have the contingency table in nice output format. Thanks for your time and help.</p>