r - {knitr}在{DT}中嵌入图像并输出为pdf时弹出错误,请指教
问题描述
使用{knitr} & {DT},我们可以将图像嵌入到DT中,将图像和数据一起制作一个表格,但是输出为PDF时会产生错误,请告知我该如何解决?</p>
yy = "c:/Program Files/RStudio/www/favicon.ico"
img_uri <- function(x) { sprintf('<img src="%s"/>', knitr::image_uri(x)) }
dat <- data.frame(
country = c('rstudio'),
flag = img_uri(yy))
DT::datatable(dat, escape = FALSE)
到目前为止,它可以生成一个包含图像和数据的表格。但是输出到pdf时会弹出错误。
output file: 2019-09-05-EXP-report.knit.md
ERROR: Functions that produce HTML output found in document targeting latex
output.
Please change the output type of this document to HTML. Alternatively, you can allow
HTML output in non-HTML formats by adding this option to the YAML front-matter of
your rmarkdown file:
always_allow_html: yes
Note however that the HTML output will not be visible in non-HTML formats.
已添加always_allow_html: yes
at YAML,但它只是停止运行。请指教,非常感谢。
解决方案
推荐阅读
- powerbi - PowerBI 可视化编辑
- excel - 调用 UserForm_Click 子例程
- ios - 是否可以以编程方式将“按钮形状”覆盖为关闭?
- python - matplotlib 中的复杂极坐标图
- reporting-services - 如何根据 DataSet 更新 SSRS 报表表
- javascript - 如何检查我是否连续两次选择了相同的下拉列表选项?
- java - 为什么java程序中的这个输出打印值300
- debugging - Pytorch 错误:无法使用来自“CUDATensorId”后端的参数运行“aten::slow_conv3d_forward”
- java - 通过“冒泡排序”按字母顺序对几个名称进行排序,并附上注释
- wso2 - Wso2 用户自行注册到租户域返回 401 Unauthorized