'R: Why are my icons not showing on my datatable? (Shiny app)

I have hundreds of images stored locally which I want to include in my Shiny App table. I start by creating a path to each image as a variable

path = "/Users/author/folder/subfolder/"

df%<>% mutate(Image = paste(path, ID, ".png", sep = ""))

I subsequently process them as advised on Adding an image to a datatable in R


for (i in df$Image) {

  df$ProcessedIcon <- knitr::image_uri(i)

}

I then create the Icon variable with the processed information


df%<>% mutate(Icon = paste("<img src=", ProcessedIcon ,"></img>", sep = ""))

my server looks like

server <- function(input, output) {
  
  
  table2 <-  reactive  ({

    df %>%
      select(Icon, Category, SubCategory, Item)

  })
  
  
  
  output$foodtable <- DT::renderDataTable({
    
    
    DT::datatable(table2(), escape = FALSE)
    
    
  })

}

My icons still looks like this

enter image description here

Why are the icons not loading properly?

What am I missing?



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source