如何使用自包含图像从.Rmd文件生成html文档?我正在使用bsplus包和rmarkdown创建一个图像轮播.当我在.Rproj工作目录中打开.html输出时,它工作正常,但是当我将文件发送给某人时,图像不再显示.
是否有可能获得带有相应图像的“自包含”.html文件输出?或者我应该发送所有文件夹依赖项?
代码如何看起来的例子……
---
title: "test"
author: "me"
date: "today"
output: html_document
---
```{r setup, include=FALSE}
knitr::opts_chunk$set(echo = TRUE)
```
## R Markdown
This is an R Markdown document. Markdown is a simple formatting syntax for authoring HTML, PDF, and MS Word documents. For more details on using R Markdown see .
When you click the **Knit** button a document will be generated that includes both content as well as the output of any embedded R code chunks within the document. You can embed an R code chunk like this:
```{r carousel}
bs_carousel(id = "the_beatles", use_indicators = TRUE) %>%
bs_append(
content = bs_carousel_image(src = image_uri("img/john.jpg")),
caption = bs_carousel_caption("John Lennon", "Rhythm guitar, vocals")
) %>%
bs_append(
content = bs_carousel_image(src = image_uri("img/paul.jpg")),
caption = bs_carousel_caption("Paul McCartney", "Bass guitar, vocals")
) %>%
bs_append(
content = bs_carousel_image(src = image_uri("img/george.jpg")),
caption = bs_carousel_caption("George Harrison", "Lead guitar, vocals")
) %>%
bs_append(
content = bs_carousel_image(src = image_uri("img/ringo.jpg")),
caption = bs_carousel_caption("Ringo Starr", "Drums, vocals")
)
```