0

In a shiny app I'm showing a table where a column must have links to different websites, referred as "info". But I found that this doesn't work

tagList( as.character(a("info",href="https://plus.google.com/communities/107454103091776894629/stream/c37ddecb-dd31-4a62-bfe0-5d48d9309b8b")))

but this one does, showing correctly a hyperlink

tagList( as.character(a("info",href="https://plus.google.com/communities/107454103091776894629/")))

This is contained in a DT::renderDataTable in a shiny app (with escape=FALSE) Yes, the second code works, and I noticed that the one difference was that this last one doesn't have dashes. Already tried sprintf.

In a ui

ui <- fluidPage(fluidRow(
  column(width = 12,
         div(dataTableOutput("web_scraped"), style = "font-size:70%")
  ))
)

meanwhile a server has

server <- function(input, output, session) {
  output$web_scraped <- DT::renderDataTable(
      DT::datatable({
        data.frame("test"=HTML( as.character(a("info",href="https://plus.google.com/communities/107454103091776894629/"))),stringsAsFactors = FALSE)
      },escape = FALSE))
}
shinyApp(ui = ui, server = server)

I need it to be

server <- function(input, output, session) {
output$web_scraped <- DT::renderDataTable(
  DT::datatable({
    data.frame("test"=HTML( as.character(a("info",href="https://plus.google.com/communities/107454103091776894629/stream/c37ddecb-dd31-4a62-bfe0-5d48d9309b8b"))),stringsAsFactors = FALSE)
  },escape = FALSE))
}
shinyApp(ui = ui, server = server)
RLesur
  • 5,810
  • 1
  • 18
  • 53
Mikael
  • 113
  • 1
  • 8
  • What does you mean by "work" exactly? How can we tell which is working and which is not? It's easier to help you if you include a simple [reproducible example](https://stackoverflow.com/questions/5963269/how-to-make-a-great-r-reproducible-example) with sample input and desired output that can be used to test and verify possible solutions. I don't know what the desired output is here. – MrFlick Jan 23 '19 at 22:33
  • @MrFlick sorry, I edited the text. I hope it's more clear – Mikael Jan 23 '19 at 22:37
  • Can you provide a minimal shiny app then that shows how you are using this inside a `DT::renderDataTable`? I can't tell from what you provided how those would be different. – MrFlick Jan 23 '19 at 22:39
  • @MrFlick does it helps? – Mikael Jan 23 '19 at 22:53
  • I don't see a difference. Those both seem to open new websites for me. No errors of any kind. Tested with `shiny_1.1.0` and `DT_0.4` – MrFlick Jan 23 '19 at 23:02
  • 1
    funny thing is that it worked right now. not sure what happened. Thank you (feel silly, oh well) – Mikael Jan 23 '19 at 23:26

0 Answers0