With {knitr} & {DT}, we can embed image to DT and make a table with image and data altogether, but it generates ERROR when output as PDF, please advise how I can fix it?
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)
It works so far to generate a table with image and data altogether. But error pops out when output to 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.
Have add the always_allow_html: yes
at YAML, but it just stop running. Please advise and many thanks.