How can I produce an html document from a .Rmd file, with self-contained images? I am using the bsplus
package along with rmarkdown
to create a carousel of images. It works perfectly when I open the .html
output within the .Rproj
working directory, but the images are no longer displayed when I send the file to someone.
Would it be possible to get a "self-contained" .html file output with the corresponding images? or should I send also all folder dependencies?
Example of how the code looks like...
---
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 <http://rmarkdown.rstudio.com>.
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")
)
```