title: How to group columns in R markdown?
body: <p>I am trying to generate a table using kable and saving the output as a markdown. I am later using pandoc to convert markdown to pdf. For my table I would like to group my table columns into two groups.  It seems that this could be achieved using the kableExtra "add_header_above" function, but unfortunately the output cannot be stored as markdown. Is there a way to group columns using markdown? I am pasting my dummy code below. Appreciate all comments and suggestions. </p>
  
  <pre><code>library(knitr)
  library(kableExtra)
  test &lt;- head(mtcars, head=10)
  test &lt;- test[,c(1:6)]
  kable(test, "markdown")
  </code></pre>
  
  <p>I have tried grouping the columns like below but it doesn't seem to work.</p>
  
  <pre><code>       |                  |     GroupA     |      GroupB     |
         |:-----------------|:---------------|:----------------|
         |                  |  mpg| cyl| disp|  hp| drat|    wt|
         |:-----------------|----:|---:|----:|---:|----:|-----:|
         |Mazda RX4         | 21.0|   6|  160| 110| 3.90| 2.620|
         |Mazda RX4 Wag     | 21.0|   6|  160| 110| 3.90| 2.875|
         |Datsun 710        | 22.8|   4|  108|  93| 3.85| 2.320|
         |Hornet 4 Drive    | 21.4|   6|  258| 110| 3.08| 3.215|
         |Hornet Sportabout | 18.7|   8|  360| 175| 3.15| 3.440|
         |Valiant           | 18.1|   6|  225| 105| 2.76| 3.460|
  </code></pre>