I am looking to create a table in a PDF document using rmarkdown
, knitr
and pander
. The table should be nearly identical to Table 1 sh
The default multiline
style table does not support arbitrary block elements inside of the cells, but the grid
tables does. So this is possible, just make sure:
grid
styleleft
keep.line.break
Quick demo:
mytable = data.frame(
Concept = c("Decoded", "XXX"),
Description = c("* Founded in 2011\ \n* Offers workshops to take people from zero skills and knowledge in programming through to coding a multi-platform app using HTML, CSS and Javascript in a single day", "XXX"),
Website = c("http://decoded.com/uk/","XXX"))
pander::pander(mytable, keep.line.breaks = TRUE, style = 'grid', justify = 'left')
Resulting in a nicely formatted HTML list via pandoc
:
<table>
<colgroup>
<col width="13%" />
<col width="43%" />
<col width="30%" />
</colgroup>
<thead>
<tr class="header">
<th align="left">Concept</th>
<th align="left">Description</th>
<th align="left">Website</th>
</tr>
</thead>
<tbody>
<tr class="odd">
<td align="left">Decoded</td>
<td align="left">* Founded in 2011 * Offers workshops to take people from zero skills and knowledge in programming through to coding a multi-platform app using HTML, CSS and Javascript in a single day</td>
<td align="left">http://decoded.com/uk/</td>
</tr>
<tr class="even">
<td align="left">XXX</td>
<td align="left">XXX</td>
<td align="left">XXX</td>
</tr>
</tbody>
</table>
But works with PDF as well: