create Hyper link in the table

203 views
Skip to first unread message

Jyoti kant Choudhary

unread,
Jun 2, 2021, 7:09:43 PM6/2/21
to Shiny - Web Framework for R
can you tell me how to create hyperlink in shiny R Table. There are two columns in our table one column is text second column is link Column. I want to hyperlink this column. 

afton...@gmail.com

unread,
Jun 4, 2021, 2:18:02 PM6/4/21
to Shiny - Web Framework for R

I was able to create hyperlinks in a table in Shiny by using the gt package and mostly copying the answer from cderv here. :)

Here's the code I used:

ui:
```
gt::gt_output("test_table")
```

server:
```
  output$test_table <- gt::render_gt({
    data.frame(id = c(1, 2),
                         link = c("<a href = https://www.stepsandspells.com>rarely updated blog</a>",
                                       "<a href = https://www.twitch.tv/aftonsteps>twitch channel</a>")) %>%
      dplyr::mutate(link = purrr::map(link, ~ gt::html(as.character(.x)))) %>%
      gt::gt()
  })
```

Result:
Screen Shot 2021-06-04 at 11.13.54 AM.png

Reply all
Reply to author
Forward
0 new messages