Display more than one url links in shiny interface



...I have a dataframe consist of 100 samples. There are two column, one url link, second a name or a heading to the url link. I want to display all those headings in shiny interface. Clicking which leads the user to the respective link page. How can I do that? Please helpstrong text


If your dataframe is called df and columns called url and heading this should work...


df$link <- paste0("<a href='", df$url, "' target='_blank'>", df$heading, "</a>")

ui <- fluidPage(

server <- function(input, output) {
  output$table <- DT::renderDataTable({
    DT::datatable(df[, "link", drop = FALSE], escape = FALSE)

shinyApp(ui, server)


Hey paul I exactly used the same code.

But its throwing a error 'data' must be 2-dimensional (e.g. data frame or matrix)


sorry yes the df[, "link"] subset was converting the data frame to a character vector as there was only 1 column left. Adding drop = FALSE inside the square brackets will ensure it keeps the data frame class. I've updated the code above to include this.



Thanxxx a lot Paul Its working fine now