Download plot in shiny app where data was uploaded






















Sign up using Facebook. Sign up using Email and Password. Post as a guest Name. Email Required, but never shown. The Overflow Blog. Who owns this outage? Building intelligent escalation chains for modern SRE.

Podcast Who is building clouds for the independent developer? Awesome example and thank you! Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment. You signed in with another tab or window. Reload to refresh your session. SQLite local SQLite is a very simple and light-weight relational database that is very easy to set up. The basic parts of a Shiny app. How to get help. App formats and launching apps.

Introduction to R Markdown. Introduction to interactive documents. Setting Output args via Render functions. Generating downloadable reports. Shiny Gadgets. Reactivity - An overview. How to understand reactivity in R. Database basics - dplyr and DBI. Using the pool package basics. Using the pool package advanced. Using dplyr and pool to query a database.

Persistent data storage in Shiny apps. Application layout guide. Build a dynamic UI that reacts to user input. Displaying and customizing static tables.

How to use DataTables in a Shiny App. Help users download data from your app. Help users upload files to your app. Interactive plots. Selecting rows of data. Interactive plots - advanced. JavaScript actions packaged for Shiny apps. How to build a JavaScript based widget. How to add functionality to JavaScript widgets. How to send messages from the browser to the server and back using Shiny. How to develop an interactive, dynamic help system for your app with introJS. How to create custom input bindings.

Putting everything together to create an interactive dashboard. Using custom CSS in your app. Solution We can use the fileInput widget with the accept argument set to. Please upload a. Solution Instead of limiting our file selection to a csv as above, here we are going to limit our input to a png. We customize the legend so that only the name of the highlighted series is shown.

To do this, one option is to write a css file with the instructions and pass the css file to the dyCSS function. Alternatively, we can set the css directly in the code as follows:. We use the leaflet package to build an interactive map. In ui we use leafletOutput , and in server we use renderLeaflet. Inside renderLeaflet we write the instructions to return a leaflet map. First, we need to add the data to the shapefile so the values can be plotted in a map.

For now we choose to plot the values of the variable in We create a dataset called datafiltered with the data corresponding to that year. Then we add datafiltered to map data in an order such that the counties in the data match the counties in the map. We create the leaflet map with the leaflet function, create a color palette with colorBin , and add a legend with addLegend.

For now we choose to plot the values of variable cases. We also add labels with the area names and values that are displayed when the mouse is over the map. Now we add functionality that enables the user to select a specific variable and year to be shown.

To be able to select a variable, we include an input of a menu containing all the possible variables. Then, when the user selects a particular variable, the map and the time plot will be rebuilt. Each input function requires several arguments. The first two are inputId , an id necessary to access the input value, and label which is the text that appears next to the input in the app.

We create the input with the menu that contains the possible choices for the variable as follows. In this input, the id is variableselected , label is "Select variable" and choices contains the variables "cases" and "population". Thus, when we select a different variable in the menu, all the outputs that depend on the input will be rebuilt using the updated input value.

Similarly, we add a menu with id yearselected and with choices equal to all possible years so we can select the year we want to see. In leaflet we modify colorBin , addPolygons , addLegend and labels to show variableplot instead of variable cases. Note that a better way to modify an existing leaflet map is using the leafletProxy function. Details on how to use this function are given in the RStudio website.

The content of the app. R file is shown below and a snapshot of the Shiny app is shown in Figure Instead of reading the data at the beginning of the app, we may want to let the user upload his or her own files.



0コメント

  • 1000 / 1000