How can I insert pdf images in an R presentation? - r

I am writing an R presentation in an .Rpres file. I published my presentation on Rpubs here: http://rpubs.com/cr517/presentationGurdon
I have images stored in PDF files. I am trying to include them in my presentation, unsuccesfully. I am using this command to include the images:
![Chromosome sizes](input/images/bar/nbOfGenesPerChrom.pdf)
the same as for .jpg. This command does not result in the display of the image. I have tried to follow these answers but could not make it work:
R markdown: can I insert a pdf to the r markdown file as an image?
Add pdf file in Rmarkdown file
If somebody could help me, that would be much appreciated. That would spare me the re-run of my code exporting images in .jpg format.
Thank you so much.

Related

Adding images to a PDF R markdown

Very new to R. I need to make a PDF document using R markdown for a lab report.
How do I add images to a markdown?
You can include this in your .Rmd file:
![Add some text here](path_to_your_image)
I would also recommend you to take a look at this book (written by the authors of R Markdown) if you want to learn more.

Converting .Docx with images to Rmarkdown not working well

I have a word document with notes from a class. In this document there are images (screenshots from the lecture). I am hoping to make a book, hopefully in bookdown, to help me organize my notes and my R code. I used pandoc to convert the word document and extracted the images, but only some of the images are showing up when i knit the markdown output in RStudio. Any idea why some would show and some wouldnt? COuld it be because i'm changing the .md that pandoc gives to .rmd and they just dont play well together?

R Markdown file does not display plots in Github .md file

Created a R Markdown analysis in RStudio, and used Knitr to create an HTML file and preserve the .md file. The local HTML file is rendered as expected; plots and formatting. But when I push to my Github repo, the plots are not displaying: https://github.com/GoodTimeWagon/RepData_PeerAssessment1/blob/master/Reproducible_Research_Peer_Assessment_1.md
In place of a plot it says -
![](Reproducible_Research_Peer_Assessment_1_files/figure-html/histogram daily steps-1.png)
I've pushed the image files as well as the markdown, so I'm really at a loss. Thank you in advance for answers.

knitr html to Word docx using pandoc

I have been saving some example R markdown html output to Word using pandoc. I actually only do this so I can add some page breaks for easier printing:
system("pandoc -s Exercise1.html -o Exercise1.docx")
Although the output is acceptable I was wondering if there is a way to keep the original syntax highlighting of the R chunks (just as they are in the original knit HTML document)?
Also, I seem to be loosing all images in the conversion process and have to stick them into Word by hand. Is that normal?
Using the rmarkdown package (baked into RStudio Version 0.98.682, the current preview release) it's very simple to convert Rmd to docx, and code highlighting is included in the docx file.
You just need to include this at the top of your markdown text:
---
title: "Untitled" # obviously you can change this
output: word_document # specifies docx output
---
However, it seems that page breaks are still not supported in this conversion.
Why not convert the markdown directly to Word format?
Anyway, Pandoc does not support syntax highlighting in Word: "Currently, the only output formats that uses this information are HTML and LaTeX."
About the images: the Word file would definitely include those if you'd convert the markdown to Word directly. I am not sure about the HTML source, but I suppose you might have a path issue.

How can I Insert images into .rnw document

I work in R and deliver PDF file with Sweave, sweave(.rnw document). I need to put into my text a JPEG image. I didn't find any function on the web and have no ideas about how I could do that.
You include it just like you include an image in any other LaTeX document:
http://amath.colorado.edu/documentation/LaTeX/reference/figures.html#pdf
\includegraphics{myimage.jpg}
Put it in a LaTeX block not an R code block. As the link points out, you'll need to compile with pdflatex.

Resources