Does anyone know how to import/upload a png image from a (working) directory into a RStudio Notebook script? I like to include it in the HTML output from the Notebook. The suggested script in Rmarkdown (http://rmarkdown.rstudio.com/authoring_basics.html) does not work in Notebook.
Here is some code that I have used/created:
#' Plot pathways using the bioconductor *pathview* package. Five *.png images are placed in the working directory by default.
>p <- pathview(gene.data=foldchanges, pathway.id=keggresids, species="hsa"))
>str(p)
The log of 'str(p)' is a list of 5 (one for each pathway) each consisting of a data.frame plot.data.gene with 10 variables and a plot.data.cpd: NULL
One can use the example on p.3-6 of the pathview vignette (https://www.bioconductor.org/packages/3.3/bioc/vignettes/pathview/inst/doc/pathview.pdf).
Since the image is printed to the working directory, it won't show up in my Notebook HTML. Is there a way to import the image back into the document so it will render into the HTML document? I am not working in a markdown document, but in a regular R script that I compile into an HTML Notebook by selecting the Notebook icon on (or ctrl+shift+K), hence the following markdown script won't work:
![imagename](/images/file.png)
Any suggestions?
Hmm, is this what you want? Just inserting a png into a R markdown file?
---
title: "Crab"
output: html_document
---
#![Here is a Crab](Crab.png)
You can also embed plots, for example:
```{r, echo=FALSE}
plot(cars)
```
This is a pretty old question, but I have a working solution and found this question while looking for my solution.
To add an image from a website (taken directly from a Markdown cheatsheet by Adam Pritchard):
![alt text](https://github.com/adam-p/markdown-here/raw/master/src/common/images/icon48.png "Logo Title Text 1")
Or to add an image from your local drive, use the following (works on Mac OSX):
![Fancy image description](/Users/path/to/you/file.png)
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With