任何人都知道 Rmarkdown 的任何图片库包或创建画廊的好方法吗?我刚刚开始尝试一些香草代码,但还有很长的路要走。只是想在进入这个兔子洞之前与社区核实一下我是否遗漏了一些已知或明显的解决方案。
下面是一个工作示例。
---
title: "Gallery"
output:
html_document:
theme: united
---
<br>
```{r,include=FALSE}
paths <- c(
"https://images.pexels.com/photos/7604423/pexels-photo-7604423.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940",
"https://images.pexels.com/photos/5483373/pexels-photo-5483373.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940",
"https://images.pexels.com/photos/4982737/pexels-photo-4982737.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940",
"https://images.pexels.com/photos/3773652/pexels-photo-3773652.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940"
)
len <- length(paths)
width <- paste0(100/len,"%")
```
```{r,echo=FALSE,fig.show="hold",out.width=width}
knitr::include_graphics(paths)
```
```{r,include=FALSE}
paths <- c(
"https://images.pexels.com/photos/3845111/pexels-photo-3845111.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260",
"https://images.pexels.com/photos/3933996/pexels-photo-3933996.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=750&w=1260",
"https://images.pexels.com/photos/1033729/pexels-photo-1033729.jpeg?auto=compress&cs=tinysrgb&dpr=2&h=650&w=940"
)
len <- length(paths)
width <- paste0(100/len,"%")
```
```{r,echo=FALSE,fig.show="hold",out.width=width}
knitr::include_graphics(paths)
```