Reputation: 4917
I still can't get my interactive doc to incorporate a png file on shinyApps.io.
Scenario:
.Rmd
file + .PNG
fileThe rmd file consists of the following code:
---
title: "TroubleShoot"
output: html_document
runtime: shiny
---
```{r ,echo=FALSE,eval=T}
library(png)
library(grid)
img <- readPNG("./mypic.PNG")
grid.raster(img)
```
As you can see, I've tried using relative paths (i.e., "./
") to make this code work. (I've also tried just using the image's name by itself).
However, the document fails to execute properly locally on my machine.
It generates the error: Error: unable to open ./mypic.PNG
Note: however, it does work if I explicitly define the absolute file path.
I try to publish the interactive doc to shinyApps.io anyway.
.Rmd
and .PNG
file are uploaded. I still get the same error once the app is deployed: Error: unable to open ./mypic.PNG
What am I doing wrong?? What can I do to make this work???
Upvotes: 1
Views: 217
Reputation: 126
It works when using the right absolute path for shinyapps.io
it looks like this:
"/srv/connect/apps/APP_NAME/MyImage.png"
I used knitr::include_graphics("/srv/connect/apps/APP_NAME/MyImage.png")
I know it´s a post from 4 years ago, but I had the same question and could not find a good answer anywhere.
Upvotes: 1