This is my sample code
library(shiny)
library(tidyverse)
library(DT)
ui <- fluidPage(
DTOutput('table')
)
server <- function(input, output, session) {
tibble(name = c("A", "B", "C"),
file_key = c("sample_A.pdf", "sample_B.pdf", "sample_C.pdf")) -> df
output$table <- DT::renderDT({
DT::datatable(df)
})
}
shinyApp(ui, server)
The respective files are stored in the home directory.
What I want to do is mutate the second column into a download button, which on click download the respective files. I found this post from stack overflow where they have used shinyInput and downloadhandler to achieve a similar outcome. But I cant figure out a way to make it work for me. If somebody could help me to understand this it'll be of great help. Thanks in advance.