-
-
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') | |
) |
Hi there,
I managed to solve this with the qq function, a Perl like function in the GetoptLong package on variable interpolation within text strings.
Thanks,
Mike
it's really helpful for me , Thank you so much
Thanks a lot! Great trick!
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
sorry, I realise that, if adding the desired variable pic to the html code above would return "value-of-pic.JPG.JPG", but I'm sure it doesn't work with the correction "Work = '' for the reasons stated above.
Thanks,
Mike