r - Grouping names for table column headings in RMarkdown for Word/docx output -
i want group column names in rmarkdown table word/docx output.
using pandoc.table
:
library(pander) pandoc.table(mtcars[1:3, 1:4], style = "rmarkdown") | | mpg | cyl | disp | hp | |:-------------------:|:-----:|:-----:|:------:|:----:| | **mazda rx4** | 21 | 6 | 160 | 110 | | **mazda rx4 wag** | 21 | 6 | 160 | 110 | | **datsun 710** | 22.8 | 4 | 108 | 93 |
this produces output below, fine
but, want group mpg
& cyl
in 1 group, , disp
& hp
in (modified hand):
| | group1 | group2 | |:-------------------:|:-------------:|:-------------:| | | mpg | cyl | disp | hp | |:-------------------:|:-----:|:-----:|:------:|:----:| | **mazda rx4** | 21 | 6 | 160 | 110 | | **mazda rx4 wag** | 21 | 6 | 160 | 110 | | **datsun 710** | 22.8 | 4 | 108 | 93 |
this won't work , output looks this:
if possible, add title in merged top cell, (obviously not work):
|**table 1.** table title ..........xxxxxx | |possibly wrapped next line. | |:---------------------------------------------------:| | | group1 | group2 | |:-------------------:|:-------------:|:-------------:| | | mpg | cyl | disp | hp | |:-------------------:|:-----:|:-----:|:------:|:----:| | **mazda rx4** | 21 | 6 | 160 | 110 | | **mazda rx4 wag** | 21 | 6 | 160 | 110 | | **datsun 710** | 22.8 | 4 | 108 | 93 |
Comments
Post a Comment