I want to center an image and/or text using R Markdown and knit a PDF report out of it.
I have tried using:
->Text<-
-><-
None of the answers work for all output types the same way and others focus on figures plottet within the code chunk and not external images.
The include_graphics() function provides an easy solution. The only argument is the name of the file (with the relative path if it's in a subfolder). By setting echo to FALSE and fig.align=center you get the wished result.
```{r, echo=FALSE, fig.align='center'}
include_graphics("image.jpg")
```