[R] better two column output from rmarkdown

Bos, Roger roger.bos at rothschild.com
Wed Nov 5 16:44:16 CET 2014


Disclaimer: This question is more about HTML than R, but since I am using rmarkdown, I am not sure of a better forum to ask this.  The code example below produces two column HTML output.  If you run the example you will see that the "bbbb" paragram starts off at the bottom of the first column and wraps around to the top of the second column.  I am wondering if there is a HTML tag or anything so I can keep the "bbbb" section together and not have it wrap to the next column.  Also, if you know of a better way to create two column output, I would be happy hear that as well.  I have placed the CSS inside the .Rmd file to make it easier to run.

library(rmarkdown)
render('example.Rmd')


example.Rmd file:
---
output:
  html_document:
    theme: readable
    highlight: null
    css: null
    fig_width: 1
    fig_height: 1
    fig_caption: true

---
<style type="text/css">
#TEST {
       -moz-column-count: 2;
       -moz-column-gap: 20px;
       -webkit-column-count: 2;
       -webkit-column-gap: 20px;
}
</style>

```{r test, eval=TRUE, echo=FALSE, error=FALSE, message=FALSE, warning=FALSE}

aa <- paste(rep('aaaaa', 49), collapse=" ")
bb <- paste(rep('bbbb', 49), collapse=" ")
cc <- paste(rep('ccc', 49), collapse=" ")
dd <- paste(rep('dd', 49), collapse=" ")
ee <- paste(rep('e', 49), collapse=" ")
```

### TEST ### {#TEST}
`r aa`

`r bb`

`r cc`

`r dd`

`r ee`



***************************************************************
This message and any attachments are for the named person's use only.
This message may contain confidential, proprietary or legally privileged
information. No right to confidential or privileged treatment
of this message is waived or lost by an error in transmission.
If you have received this message in error, please immediately
notify the sender by e-mail, delete the message, any attachments and all
copies from your system and destroy any hard copies. You must
not, directly or indirectly, use, disclose, distribute,
print or copy any part of this message or any attachments if you are not
the intended recipient.




More information about the R-help mailing list