title: Creating tables in R
body: <p>I have a data frame and I want to create a specific table in R showing the summary statistics. Getting the summary statistics aren't a problem, it is just formatting the table. </p>
  
  <p>Here is my data</p>
  
  <pre><code>df1 &lt;- data.frame(DAY = c(0,1,0,1), Value = c(1,2,3,4),Change=c(0,4,8,10),treatment=rep("A",4))
  df2  &lt;- data.frame(DAY = c(0,1,0,1), Value = c(5,6,7,8),Change=c(5,7,8,9),treatment=rep("B",4))
  
  data &lt;- rbind(df1,df2)
  </code></pre>
  
  <p>I want the table to look like</p>
  
  <pre><code>                  Drug A                     Drug B         
                    (N = 2)                    (N = 2)                  
      ___________________________  _______________________________
  
    _________Value______Change___________Value _____ Change                                       
  DAY 0                                                                                                                             
  n               2           2             2          2                     
  Mean            2           4             6          6.5                       
  
  Day 1                                                                                                                                         
  n               2           2             2          2
  Mean            3           7             7          8
  </code></pre>
  
  <p>I don't care about the lines, they are just there to make the table easier to understand</p>
  
  <p>I tried formatting the data frame by having a matrix with the column names of Value, change, value and change and the row names being day 0, n, mean, day 1, n and mean with the day rows being an empty string but I'm missing the Drug A and drug B parts. </p>