在R Shiny中创建URL超链接? [英] Create URL hyperlink in R Shiny?

查看:548
本文介绍了在R Shiny中创建URL超链接?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的代码:

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)
    })
  })
)

当前输出:

网址链接:< a href =https://www.google.com/> Google主页< / a>

期望输出:

网址链接:Google主页

其中 Google主页是一个可点击的超链接。

where Google Homepage is a clickable hyperlink.

我目前正在使用在 renderUI / uiOutput 朵如下指示:如何交互地在有光泽的应用程序创建超链接?

I'm currently using the renderUI/uiOutput duo as instructed here: how to create a hyperlink interactively in shiny app?

推荐答案

通过使用粘贴,你治疗网址为字符串。你想在这里使用的函数是 tagList

By using paste, you're treating the url as 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)
    })
  })
)

这篇关于在R Shiny中创建URL超链接?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆