pssguy
pssguy

Reputation: 3505

How can I render a shiny datatables as a link

Say I have one column of a data.frame that has a list of urls e.g

urlCol
http://mysite1.com
http://mysite2.com

How do I set that as a clickable link in renderDataTable?

TIA

Upvotes: 3

Views: 1441

Answers (1)

jdharrison
jdharrison

Reputation: 30425

The url can be wrapped in an anchor tag:

library(shiny)
runApp(
  list(ui = fluidPage(
    dataTableOutput("myTable")
  )
  , server = function(input, output, session){
    output$myTable <- renderDataTable({
      data.frame(name = c("GOOGLE", "YAHOO")
                 , url = c("<a href=\"http://www.google.com\">http://www.google.com</a>"
                           , "http://yahoo.com")
                           )
    })
  })
)

enter image description here

Upvotes: 1

Related Questions