Code Monkey home page Code Monkey logo

Comments (3)

aagarw30 avatar aagarw30 commented on June 25, 2024

Hello David,
Thanks for the details.

Sharing the observation -
Not sure why you have input$var3 in your downloadhandler(). The UI does not have any input widget with var3 input ID.

Nevertheless, I ran the code with the following updates -
output$down <- downloadHandler(
filename = function() {
paste("iris", input$type, sep=".") # replace input$var3 by input$type ty Abi
},
# content is a function with argument file. content writes the plot to the device
content = function(file) {
if(input$type == "png") # replace input$var3 by input$type ty Abi
png(file) # open the png device
else
pdf(file) # open the pdf device
hist(colm()) # draw the plot
dev.off() # turn the device off

} 

)

Code ran without any errors.

Important Point to note -
I am guessing that you are running the app in the window. This would be the "Run in Window" option of the "Run App" icon in the RStudio. If so, then for some reason RStudio would pop up the dialog box ignoring the file name you create using paste and would show the file name as the output ID of download handler which in your case is "down". It is a known behavior.

I suggest you choose "Run External" and then you should be able to download the file with the file name you have defined in the downloadhandler function. I have tested it and should work for you. Let me know how it goes.

I will exclusively make a video as well to show this to you tube viewers so it is easy to understand and they do not take this as a failure on them or an issue per say.

I will wait for your response so can close this item.

Thanks, have a great day!

Regards,
Abi

from r-shinyapp-tutorial.

davidrajm avatar davidrajm commented on June 25, 2024

from r-shinyapp-tutorial.

aagarw30 avatar aagarw30 commented on June 25, 2024

Youtube video from my channel reproducing and explaining the behavior of download plot
https://youtu.be/a6UOnYejni8

from r-shinyapp-tutorial.

Related Issues (4)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.