title: Merge several confusion matrix with xtable
body: <p>I have trained several models and want to summarise their performance with three confusion matrix.  <strong>What I want to do is to combine three different confusion matrix into one table using <code>xtable</code></strong>. I want to combine table 1, 2 and 3.  See an example below using XGBoost.</p>
  <pre><code>require(xgboost)
  require(xtable)
  require(caTools)
  require(tidyverse)
  
  set.seed(1234)
  
  # Loading data
  x1 = c(rnorm(10000, 0,1), rnorm(10000,3,1))
  x2 = rnorm(1000)
  x3 = rnorm(1000)
  class= factor(rep(0:1, each=10000))
  
  df &lt;- as.data.frame(cbind(x1, x2, x3, class))
  
  # Preparing target variable
  df$class &lt;- as.numeric(df$class)
  df$class &lt;- df$class -1
  
  # Creating a hold-out data
  train &lt;- sample.split(df$class, SplitRatio = 0.70)
  train.df &lt;- subset(df, train == TRUE)
  test.df &lt;- subset(df, train == FALSE)
  
  #Labels. 
  labels.train &lt;- train.df[c('class')]
  labels.test &lt;- test.df[c('class')]
  
  # Dropping target variable.
  train.df &lt;- train.df %&gt;%
    dplyr::select(-class)
  
  test.df &lt;- test.df %&gt;%
    dplyr::select(-class)
  
  # Converting to appropiate format. 
  train &lt;- xgb.DMatrix(as.matrix(train.df), label = as.matrix(labels.train))
  test &lt;- xgb.DMatrix(as.matrix(test.df), label = as.matrix(labels.test))
  
  watchlist &lt;- list(eval = test, train = train)
  
  # Running the model
  model &lt;- xgb.train(data=train,
                     watchlist = watchlist,
                     nround = 1000, 
                     early_stopping_rounds = 25,                 
                     objective = &quot;binary:logistic&quot;)
  
  # Predictions
  pred &lt;- predict(model, test)
  
  # Evaluating the p-distribution. 
  hist(pred)
  
  # Confusion matrix
  table1 &lt;- table(pred &gt; 0.5, labels.test$class)
  table2 &lt;- table(pred &gt; 0.25, labels.test$class)
  table3 &lt;- table(pred &gt; 0.75, labels.test$class)
  
  print(xtable(table1, caption = 'Threshhold = 50%'))
  print(xtable(table2, caption = 'Threshhold = 25%'))
  print(xtable(table3, caption = 'Threshhold = 75%'))
  </code></pre>
  <p>The outcome now looks like this</p>
  <p><a href="https://i.stack.imgur.com/Pju86.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/Pju86.png" alt="enter image description here" /></a></p>
  <p>but I want it to look something like this</p>
  <p><a href="https://i.stack.imgur.com/YP90j.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/YP90j.png" alt="enter image description here" /></a></p>