I have an R analysis that I want to present in an R markdown table. The table's layout demands some empty cells:
x <- c(1:14)
Header1 | Header2 | Header3 | Header4
------- | ------- | -------- | -------
Label1 | LabelA | `r x[1]` | `r x[4]`
Label2 | LabelB | `r x[2]` | `r x[5]`
| LabelC | `r x[3]` | `r x[6]`
| LabelD | | `r x[7]`
------- | ------- | -------- | -------
Label3 | LabelA | `r x[8]` | `r x[11]`
Label4 | LabelB | `r x[9]` | `r x[12]`
| LabelC | `r x[10]`| `r x[13]`
| LabelD | | `r x[14]`
However, those empty cells are causing the layout to break, ie, LabelC
appears directly under Label2
even though it is supposed to be one column over.
I know, from searching on this issue, that you can't merge table cells in R Markdown. But can I fill those cells with code such that they will present as empty? I tried filling them with r NULL
but nothing happened.