-
-
Save ramnathv/f476dd3751e672a96801 to your computer and use it in GitHub Desktop.
Images in Tables in Shiny
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require(shiny) | |
shinyServer(function(input, output){ | |
output$mytable <- renderTable({ | |
dat <- data.frame( | |
country = c('USA', 'China'), | |
flag = c('<img src="http://upload.wikimedia.org/wikipedia/en/thumb/a/a4/Flag_of_the_United_States.svg/200px-Flag_of_the_United_States.svg.png"></img>', '<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"></img>') | |
) | |
dat | |
}, sanitize.text.function = function(x) x) | |
}) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
require(shiny) | |
shinyUI( | |
tableOutput('mytable') | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Thanks a lot! Great trick!