R 中的文本输出作为超链接闪亮

发布于 2025-01-11 16:53:27 字数 741 浏览 0 评论 0原文

我需要将outputText(Key_facts)作为超链接,每当我从csv文件中提取它时,你能帮我弄清楚如何解决这个问题吗

library(shiny)

info_360 <- read.csv('data/360_photos.csv')
ui <-
fluidRow(
box(
title = "Key Facts",
closable = FALSE,
width = 9,
status = "primary",
solidHeader = FALSE,
collapsible = TRUE,
textOutput("keyfacts"))

server <- function(input, output,session)     {
Keyfactstext <- reactive({
if (input$mySliderText %in% info_360$press )
{
info_360 %>%
filter(press == input$mySliderText)%>%
pull(Key_facts) 

**#this contains a text that includes a website link, I need only the link to appear as a hyperlink?????????????????**

}
})

output$keyfacts<- renderText({ Keyfactstext ()})
}

shinyApp(ui = ui, server = server)    

I need to have the outputText (Key_facts) as a hyperlink, whenever I extract it from csv file could you please help me to figure out how to solve this issue

library(shiny)

info_360 <- read.csv('data/360_photos.csv')
ui <-
fluidRow(
box(
title = "Key Facts",
closable = FALSE,
width = 9,
status = "primary",
solidHeader = FALSE,
collapsible = TRUE,
textOutput("keyfacts"))

server <- function(input, output,session)     {
Keyfactstext <- reactive({
if (input$mySliderText %in% info_360$press )
{
info_360 %>%
filter(press == input$mySliderText)%>%
pull(Key_facts) 

**#this contains a text that includes a website link, I need only the link to appear as a hyperlink?????????????????**

}
})

output$keyfacts<- renderText({ Keyfactstext ()})
}

shinyApp(ui = ui, server = server)    

如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

扫码二维码加入Web技术交流群

发布评论

需要 登录 才能够评论, 你可以免费 注册 一个本站的账号。

评论(1

治碍 2025-01-18 16:53:28

这可能有效,但没有你的文件我无法测试

library(shiny)

info_360 <- read.csv('data/360_photos.csv')
ui <-
  fluidRow(
    box(
      title = "Key Facts",
      closable = FALSE,
      width = 9,
      status = "primary",
      solidHeader = FALSE,
      collapsible = TRUE,
      uiOutput("keyfacts"))
    
    server <- function(input, output,session)     {
      Keyfactstext <- reactive({
        if (input$mySliderText %in% info_360$press )
        {
          info_360 %>%
            filter(press == input$mySliderText)%>%
            pull(Key_facts) 
          
          **#this contains a text that includes a website link, I need only the link to appear as a hyperlink?????????????????**
            
        }
      })
      
      output$keyfacts<- renderUI({
        tagList$a(href = Keyfactstext(), "Click me")})
    }
    
    shinyApp(ui = ui, server = server)      

This might work but I can't test without your file

library(shiny)

info_360 <- read.csv('data/360_photos.csv')
ui <-
  fluidRow(
    box(
      title = "Key Facts",
      closable = FALSE,
      width = 9,
      status = "primary",
      solidHeader = FALSE,
      collapsible = TRUE,
      uiOutput("keyfacts"))
    
    server <- function(input, output,session)     {
      Keyfactstext <- reactive({
        if (input$mySliderText %in% info_360$press )
        {
          info_360 %>%
            filter(press == input$mySliderText)%>%
            pull(Key_facts) 
          
          **#this contains a text that includes a website link, I need only the link to appear as a hyperlink?????????????????**
            
        }
      })
      
      output$keyfacts<- renderUI({
        tagList$a(href = Keyfactstext(), "Click me")})
    }
    
    shinyApp(ui = ui, server = server)      
~没有更多了~
我们使用 Cookies 和其他技术来定制您的体验包括您的登录状态等。通过阅读我们的 隐私政策 了解更多相关信息。 单击 接受 或继续使用网站,即表示您同意使用 Cookies 和您的相关数据。
原文