title: Shiny - Generate crosstable with column total and row total as the 1st row / column
body: <p>I want to generate a crosstable with total column for row and column. I tried to generate the crosstable using gmodels package. The look of the output is better than normal table function. The look of the table is important as finally it has to be displayed using Shiny. But the problem is I get column total and row total at the end of the rows and columns. How can I get the total column as the 1st column and row in the table.</p>
  
  <p>Below is the sample of my data.</p>
  
  <pre><code>Location &lt;- sample(c("location A","location B","location C","location D","location E"),20,replace = T) 
  Brand &lt;- sample(c("Brand A","Brand B","Brand C"),20,replace = T) 
  Year &lt;- rep(c("Year 2014","Year 2015"),10)
  Q1 &lt;- sample(1:5,20,replace = T)
  Q2 &lt;- sample(1:5,20,replace = T)
  
  mydata &lt;- as.data.table(cbind(Location,Brand,Year,Q1,Q2))
  </code></pre>
  
  <p>Data is huge and hence it is data.table.</p>
  
  <p>Code that I am using for generating the cross table is -</p>
  
  <pre><code>library("gmodels")
  
  mydata[,CrossTable(Location,Brand,prop.c = T,prop.r = F,prop.t = F,prop.chisq = F,chisq = F,format = "SPSS")]
  </code></pre>
  
  <p>This gives the output but the total columns is in the end of the row and end of the column. Also column % is missing for the total column. How can I have the total columns as the 1st row and column and also have the % for it?</p>
  
  <p>Do suggest a way out. </p>