Wrap text around plots in Markdown
You can use CSS styling to position the elements however you want. However there can be some difficulties and it does require some tweaking. Here is a simple example:
---
title: "Untitled"
author: "Ian Wesley"
date: "April 21, 2017"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## R Markdown
<div style= "float:right;position: relative; top: -80px;">
```{r pressure, echo=FALSE}
plot(pressure)
```
</div>
This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see <http://rmarkdown.rstudio.com>.
When you click the **Knit** button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
Note that the `echo = FALSE` parameter was added to the code chunk to prevent printing of the R code that generated the plot.
Yields:
It appears there is an easier way now by adding two arguments to the r chunk:
out.width= "65%", out.extra='style="float:right; padding:10px"'
This scales the plot to 65% of the page width and lets text float on the left side with a distance of 10px.