Explore Courses Blog Tutorials Interview Questions
0 votes
in R Programming by (5.3k points)
edited by

I have a local image that I would like to include in an. Rmd file which I will then knit and convert to HTML slides with Pandoc. Per this post, this will insert the local image

![Image Title](path/to/your/image)

Is there a way to modify this code to also set the image size?

1 Answer

0 votes
edited by

You can read the image using the include_graphics function from the knitr package. The major advantage of using this function is that it is portable in the sense that it works for all document formats that knitr supports, so you do not need to think if you have to use.


```{r, out.width = "400px"} 

knitr::include_graphics("path/to/image.png") ```

For example:


Browse Categories