Listening on http://127.0.0.1:3454
Error in if (input$var3 == "png") png(file) else pdf(file) :
argument is of length zero
Warning: Error in if: argument is of length zero
Stack trace (innermost first):
49: download$func [D:\Documents\Documents\Monografia\Tentativa_II_app_LiDAR\R_Shiny_Tutorial\Scripts\Tutorial 10/server.R#33]
1: runApp
Error in if (input$var3 == "png") png(file) else pdf(file) :
argument is of length zero
Warning: Error in if: argument is of length zero
Stack trace (innermost first):
49: download$func [D:\Documents\Documents\Monografia\Tentativa_II_app_LiDAR\R_Shiny_Tutorial\Scripts\Tutorial 10/server.R#33]
1: runApp
My script for server is this one:
library(shiny)
shinyServer(function(input,output)({
x <- reactive({
iris[,as.numeric(input$var1)]
})
y <- reactive({
iris[,as.numeric(input$var2)]
})
output$plot <- renderPlot({
plot(x(),y())
})
output$down <- downloadHandler(
#Specify the file name
filename = function(){
#iris.png
#iris.pdf
paste("iris", input$var3, sep=".")
},
content = function(file){
# open the device
#create the plot
#close the device
#png()
#pdf()
if(input$var3 == "png")
png(file)
else
pdf(file)
plot(x(),y())
dev.off()
}
)
}))
Does anyone have a clue about what could be done to solve this? Thanks a lot! :)
--
You received this message because you are subscribed to the Google Groups "Shiny - Web Framework for R" group.
To unsubscribe from this group and stop receiving emails from it, send an email to shiny-discuss+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/shiny-discuss/4a02c2e5-6fb9-4224-a8ef-2b7b784897ce%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
To unsubscribe from this group and stop receiving emails from it, send an email to shiny-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/shiny-discuss/4a02c2e5-6fb9-4224-a8ef-2b7b784897ce%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
--
You received this message because you are subscribed to the Google Groups "Shiny - Web Framework for R" group.
To unsubscribe from this group and stop receiving emails from it, send an email to shiny-discus...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/shiny-discuss/CANTAc-5vb0F8-vYFdX8GsnMFLNK09hOY0vJdF2Tbd%3D99K6qjUg%40mail.gmail.com.