首页 > 解决方案 > 将 rmarkdown 部分转换为图像

问题描述

我有几个 rmarkdown 部分,每个混合文本、标记和代码块的只有几行,我想把它们变成图像

我还没有找到好的解决方案。也许我现在需要接受 pdf 输出并进行后期处理?有人有更好的主意吗?

这将是 rmarkdown-code 的一个示例,我想将其转换为图像。

## Question 2
Please compute the *pearson correlation* between
`mtcars$mpg` and `mtcars$disp` and round it to two digits.

### Answer
```{r}
round(cor(mtcars$mpg, mtcars$disp), 2)
```

PS:我寻找像https://github.com/yonicd/carbonate这样的东西,但是对于渲染的 rmarkdown 而不是源代码。理想情况下,我将拥有大多数用于语法突出显示和控制 rmarkdown 文档输出的选项。

标签: rr-markdownknitr

解决方案


推荐阅读