且构网

分享程序员开发的那些事...
且构网 - 分享程序员编程开发的那些事

在R Markdown PDF表中包含图像

更新时间:2023-11-29 15:51:52

---
title: "pic in column"
author: "test"
date: "2014/08/03"
output: html_document
---

```{r results='asis'}
library(knitr)
column1 <- c("1", "2", "3")
column2 <- c("a", "b", "c")
column3 <- c("x", "y", "z")

dat <- data.frame(column1, column2, column3)

dat$column1<- sprintf('![](green.png)')

print(kable(dat))
```

我只是使用了注释中的链接,并将您的问题放入代码中.如果您想为每行使用不同的图片,则可能需要将文件名保存为向量.在该示例中,您还可以使用网页中的图像

I just used the link in the comments and fit your question into the code. if you wanted different pictures for each row, you maybe need to save the file names into a vector. In the example you could also use images from a webpage