Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Add pdf file in Rmarkdown file

Tags:

pdf

r-markdown

Is it possible to display a pdf file in an Rmarkdown file? Say, for example, a previously saved image :'myimage.pdf'

What I am aiming is a form of "\includegraphics[width=0.5]{myimage.pdf}"

like image 411
user2809432 Avatar asked Jan 21 '15 17:01

user2809432


2 Answers

You can insert this directly into your R Markdown. The alternate name will only be displayed if the image does not load.

![Alternate Name](file.pdf){width=500px}
like image 151
mel Avatar answered Sep 28 '22 06:09

mel


An update from the very end of 2017
It is possible to import a PDF image using knitr::include_graphics(), e.g.

{r label, out.width = "85%", fig.cap = "caption"} include_graphics("path-to-your-image.pdf")

like image 29
ikashnitsky Avatar answered Sep 28 '22 04:09

ikashnitsky