简体   繁体   中英

Textoutput as hyperlink in R shiny

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)    

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)      

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM