当{knitr}将图像嵌入{DT}并以pdf格式输出时,会弹出错误,请告知
使用{knitr}&{DT},我们可以将图像嵌入到DT中,并用图像和数据创建一个表,但当输出为PDF时会产生错误,请建议如何修复它当{knitr}将图像嵌入{DT}并以pdf格式输出时,会弹出错误,请告知,r,knitr,R,Knitr,使用{knitr}&{DT},我们可以将图像嵌入到DT中,并用图像和数据创建一个表,但当输出为PDF时会产生错误,请建议如何修复它 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'),
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)
在YAML中添加
始终\u允许\u html:yes
,但它只是停止运行。请提供建议,非常感谢。我认为您不能在pdfThanks中使用datatable
。让我试着反馈一下。谢谢我从谢一辉本人那里找到了解决办法。通过使用kable()
。谢谢你的建议@Matt
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.