I have a R-Markdown file that includes some HTML-output that I want to knit to a pdf. My question is, is there a way of capturing the output of the Viewer and include it automatically.
For example, consider the following MWE:
---
title: "Include Viewer in PDF"
author: "Myself"
date: "today"
output:
pdf_document: default
always_allow_html: yes
---
```{r}
library(stringr)
str_view("hello world", "o\\s[sw]")
```
If I use knit to HTML, the result is shown properly:
If I use knit to PDF, the result is not shown at all (because I used always_allow_html: yes
, however if I exclude that specification, I get the error:
Error: Functions that produce HTML output found in document targeting latex output. ...
):
Any ideas?