title: Shiny app - an elegant way to display images only if the files exist
body: <p>I am currently working on a Shiny application (deployed with shiny-server, open source edition) that takes various input values and then launches a task (heavy computations) when the user clicks an <code>actionButton</code>. This task is performed by calling a script from the command line. It has to be run in the background (using <code>system("whatever", wait = FALSE)</code>) because if R waits for the command to be completed, no other user can access the application.</p>
  
  <p>The results of this script are images that I want to be displayed on the UI. At the moment, I'm checking periodically if the files exist by using <code>invalidateLater</code> in an 'observe()' context (server.R). If the files are found, then a boolean value is set to TRUE instead of FALSE and the output are displayed. </p>
  
  <p>It is working fine but it seems a bit hackish to me. I wanted to know if there is <strong>a more elegant/convenient way to display an image only if the file exist</strong> than checking periodically if the file is there or not ?  I can't think of any at the moment. </p>