...Hi,
I have below renderPlot inside observeEvent as i am dynamically plotting (histogram + boxplot) based on dynamic user selection of tests. Everything is working fine. What I need now is to be able to save whatever plots rendered & save into PDF. I tried to basically copy the whole codes inside the renderPlot into downloadHandler (with pdf(file) & dev.off() blanketing the codes) but it is not working & I am getting below error:
Warning: Error in if: argument is of length zero
[No stack trace available]
pdf file was created but 0 byte (so nothing saved).
output[[plotname]]<- renderPlot({
req(input$param) #aes string input for single plot
mybin <- input$bin
col = as.name(input$param[my_i]) #take the next parameters from the list
datcol <- as.data.frame(myval()[input$param])
lims <- as.data.frame(lims()[input$param])
ll <- lims[1,my_i]
hl <- lims[2,my_i]
ave <- round(mean(datcol[[my_i]]), digits = 4)
histop <- hist(my_i, mybin, col, datcol, lims, ll, hl, ave)
boxp <- bp(my_i, mybin, col, datcol, lims, ll, hl)
chart_align(histop, boxp)
})