title: How to embed an image in a cell a table using DT, R and Shiny
body: <p>How can I embed an image in a cell that is generated using the DT package so that it is displayed in an app using shiny?</p>
  
  <p>My example is based of this question <a href="https://stackoverflow.com/questions/20575241/r-shiny-how-do-i-put-local-images-in-shiny-tables">R shiny: How do I put local images in shiny tables</a></p>
  
  <p>The example code below doesn't display the image, but rather just the url.</p>
  
  <pre><code># ui.R
  require(shiny)
  library(DT)
  
  shinyUI(
    DT::dataTableOutput('mytable')
  )
  
  # Server.R
  library(shiny)
  library(DT)
  
  
  dat &lt;- data.frame(
    country = c('USA', 'China'),
    flag = c('&lt;img src="test.png" height="52"&gt;&lt;/img&gt;',
             '&lt;img src="http://upload.wikimedia.org/wikipedia/commons/thumb/f/fa/Flag_of_the_People%27s_Republic_of_China.svg/200px-Flag_of_the_People%27s_Republic_of_China.svg.png" height="52"&gt;&lt;/img&gt;'
             )
  )
  
  shinyServer(function(input, output){
    output$mytable &lt;- DT::renderDataTable({
  
      DT::datatable(dat)
    })
  })
  </code></pre>