I have created a shiny app that takes user input and renders a pdf report. On my Windows laptop, it seems to run fine, but deploying it to shinyapps.io shows %PDF-1.5 %. how it runs locally
Here's the app.R:
library(shiny)
ui <- fluidPage(
# App title ----
titlePanel(h2("Datasheet", style="color:darkorchid")),
helpText("Please enter the following information and download report"),
fluidRow(
column(6,
textInput("plasmid_ID", h4("Plasmid ID"),
value = ""),
helpText("This will allow for easy identification"),
textInput("person_name", h4("Name of the person filling the form:"),
value = ""),
textInput("vector_name", h4("Name of the vector:")),
downloadButton("report", "Generate report")
))
)
# Define server logic
server <- function(input, output) {
output$report <- downloadHandler(
# For PDF output, change this to "report.pdf"
filename = "report.pdf",
content = function(file) {
# Copy the report file to a temporary directory before processing it, in
# case we don't have write permissions to the current working dir (which
# can happen when deployed).
tempReport <- file.path(tempdir(), "report.Rmd")
file.copy("report.Rmd", tempReport, overwrite = TRUE)
# Set up parameters to pass to Rmd document
params <- list(plasmid_ID = input$plasmid_ID,
person_name = input$person_name,
vector_name = input$vector_name)
# Knit the document, passing in the `params` list, and eval it in a
# child of the global environment (this isolates the code in the document
# from the code in this app).
rmarkdown::render(tempReport, output_file = file,
params = params,
envir = new.env(),
intermediates_dir = tempdir())
}
)
}
shinyApp(ui = ui, server = server)
And the report.Rmd file is just a series of cat functions.
I am new to deploying shiny apps and have zero deployment/development knowledge in general. What functions would allow me to deploy and use the apps from the web server?
Deployment doesn't show any errors or problematic logs! enter image description here
downloadButton('report', 'Download report')in the UI to start thedownloadHandlerwww\plugins\mozilla.pdf.jsloaded inui.Rby<script src='plugins/mozilla.pdf.js/build/pdf.js'></script>and<script src='plugins/mozilla.pdf.js/build/pdf.worker.js'></script>.