Hi,
I made a dummy example to show you how it can be done, and you can adapt it to your full dataset.
library(shiny)
library(DT)
ui <- fluidPage(
dataTableOutput("myTable")
)
server <- function(input, output, session) {
#Get the list of manufacturer names and the link to the logo file
#File path can be online link or local image in www folder
logoList = list(opel = "<img height='50' src='https://cdn.iconscout.com/icon/free/png-256/opel-2-202862.png'></img>",
kia = "<img height='50' src='https://www.logospng.com/images/88/royal-azure-blue-kia-icon-free-car-logo-88484.png'></img>",
bmw = "<img height='50' src='https://cdn.iconscout.com/icon/free/png-256/bmw-4-202746.png'></img>")
#Create fake data (make sure the Manufacturer names match those in the logoList)
myData = reactiveVal(data.frame(Manufacturer = c("kia", "opel", "bmw", "opel"),
nCars = c(15, 85, 34, 16), stringsAsFactors = F))
output$myTable = renderDataTable({
#Swap the Manufacturer name for the image link
myData = myData()
myData$Manufacturer = unlist(logoList[myData$Manufacturer])
#Plot the table, make sure escape is false to interpret the string as HTML
datatable(myData, escape = FALSE)
})
}
shinyApp(ui, server)
I must say I didn't know this was possible until I found a
related post I modified to fit your example, so the credit is to this person really...
Hope this helps,
PJ