Create URL hyperlink in R Shiny?

My code is:

library(shiny)
runApp(
  list(ui = fluidPage(
     uiOutput("tab")
    ),
  server = function(input, output, session){
    url <- a("Google Homepage", href="https://www.google.com/")
    output$tab <- renderUI({
      paste("URL link:", url)
    })
  })
)

Current output:

URL link: <a href="https://www.google.com/">Google Homepage</a>

Required Conclusion:

URL link: Google Homepage

where Google Homepageis the interactive hyperlink.

I am currently using the duo renderUI/ uiOutputas indicated here: how to interactively create a hyperlink in a brilliant application?

+4
source share
1 answer

Using paste, you process urlas a string. The function you want to use here is tagList:

runApp(
  list(ui = fluidPage(
     uiOutput("tab")
    ),
  server = function(input, output, session){
    url <- a("Google Homepage", href="https://www.google.com/")
    output$tab <- renderUI({
      tagList("URL link:", url)
    })
  })
)
+9
source

Source: https://habr.com/ru/post/1668837/


All Articles