Hi @barret, thank you for the reply.
Here are the relevant components of the latest version of the code, with the most informative error message I have yet received:
library(shiny)
library(Cairo)
library(grDevices)
library(ggbiplot)
library(vegan)
ui <- fluidPage(
mainPanel(
tabsetPanel(
tabPanel("NMS Ordination", plotOutput("ordplot"),
downloadLink("downloadPlot", "Download Plot")
)
)
server <- function(input, output, session){
options(shiny.usecairo=T)
plotInput <- function(){
file <- tempfile(fileext = '.pdf')
pdf(file)
cairo_pdf(filename = "file",
width = 18, height = 10, pointsize = 12, family = "sans", bg = "transparent",
antialias = "subpixel",fallback_resolution = 300)
vegan::ordiplot(nms_graph) #Note that this is not the exact code (just for simplicity here)
dev.off()
dev.copy2pdf(file="file")
list(src = "file")}
output$ordplot <- renderPlot({
vegan::ordiplot(nms_graph) #Note again that this is not the exact code (just for simplicity here) - the plot is successfully rendered in the UI, but the quality is too low to useable, thus requiring a high quality download
})
output$downloadPlot <- downloadHandler(
filename = function(){paste(input$dataset, '.csv', sep = '')},
content = function(file){plotInput()},
contentType = "application/pdf",
outputOptions(output, "downloadPlot", suspendWhenHidden=FALSE)
)
}
shinyApp(ui=ui, server=server)
The error returned is as follows:
Listening on http://127.0.0.1:3133
Warning: Error in .subset2(x, "impl")$outputOptions: downloadPlot is not in list of output objects
55: stop
54: .subset2(x, "impl")$outputOptions
53: outputOptions
47: server [/Users/xxx/yyy/zzz/app.R#214]
Error in .subset2(x, "impl")$outputOptions(name, ...) :
downloadPlot is not in list of output objects
GitHub Repository for the application:
(https://github.com/marsnone/VEGDESK)