Intellipaat Back

Explore Courses Blog Tutorials Interview Questions
0 votes
2 views
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
by
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.

i.e.,

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

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

For example:

image

31k questions

32.8k answers

501 comments

693 users

Browse Categories

...