Reputation: 3011
Since the dataset that drives the app is huge, In my shiny application, I am creating a glossary page. However, I could not cover all the details. Some of them I like to provide as downloadable word or pdf files. Assuming the name of my file is
estimates.doc
which i have saved in www
folder of my app, my code within the UI of the app is as follows:
library(shiny)
ui <- navbarPage("TITLE HERE",
tabPanel("GLOSSARY",
p("Click", a(href = "~/www/Estimation_Procedure.doc", "here"), "to download.")
)
)
server <- function(session, input, output) {}
shinyApp(ui, server)
I am not sure how to include the downloadHandler here...i am getting the message "NOT FOUND".
Upvotes: 0
Views: 200
Reputation: 2775
You can use a downloadHandler and downloadLink.
library(shiny)
ui <- navbarPage("TITLE HERE",
tabPanel("GLOSSARY",
downloadLink(outputId = 'myFile' , label = 'to download' )
)
)
server <- function(session, input, output) {
output$myFile <- downloadHandler(
# generate file name
filename = function() {
'Estimation_Procedure.doc'
} ,
# set file content
content = function(file) {
file.copy('www/Estimation_Procedure.doc' , file)
}
)
}
shinyApp(ui, server)
Upvotes: 2