0

My images folder deletes itself after first knitting of the document.

I've tried self_contained = TRUE in the YAML header, doesn't work.

(I'm not sure if this makes a difference but Shiny is embedded in the dashboard)

Below is my code :

---
title : app demo
author : yeshipants
output : 
  flexdashboard::flex_dashboard:
    orientation: rows
    self_contained : TRUE
    source_code: embed
runtime: shiny
---

```{r setup}
knitr::opts_chunk$set(cache = FALSE)
```
```{r loadPackages, cache = TRUE}  
setwd("C:/Users/user/Desktop/Training/OCR")
library(magick)
```
Column {.sidebar data-width=350}
-------------------------------------
### Input & Parameters
```{r inputImages, cache = TRUE}

selectInput("imagesToChoose", 
            label = "Choose an image to process",
            choices = c("Language example 1", 
                        "Language example 2",
                        "Jounal example"),
            selected = "Language example 1") 
```
Row {.tabset}
-------------------------------------  
### Original Image    
```{r displayImage, cache = FALSE}    
renderImage({      
  if (input$imagesToChoose == "Language example 1"){
    list(src = "images/receipt.png", height = 240, width = 300)
  }
  else if(input$imagesToChoose == "Language example 2"){
    list(src = "images/french.JPG", height = 240, width = 300)
  }
  else if(input$imagesToChoose == "Jounal example"){
    list(src = "images/journal.jpg", height = 240, width = 300)
  }    
})

```
Yeshyyy
  • 669
  • 6
  • 21

1 Answers1

1

I think you have to do:

renderImage({      
  ......
}, deleteFile = FALSE)
Stéphane Laurent
  • 75,186
  • 15
  • 119
  • 225
  • Thanks Stephane !! I seriously thought it was an rmarkdown thing but it was a shiny thing. Thanks heaps ! – Yeshyyy Feb 27 '19 at 19:52