Create a variable number of plots in Shiny

Hello everyone,

Let's say I'm trying to have the user input a data frame into R Shiny as a .RData object. I don't know how many columns it contains. I want to create a histogram for each column. If I knew the number of columns, I could just create a PlotOutput for each histogram I needed in the UI <- fluidPage() part of the code. I think the best option may be to somehow combine all the histograms into one plot object--how would I go about doing that?

You could put a select control and a single plot output in the UI. In the server, populate the select control with the list of data column names when the data file is imported (using the updateSelectInput() command) and use the value of that input to figure out which variable to plot.

This topic was automatically closed 54 days after the last reply. New replies are no longer allowed.

If you have a query related to it or one of the replies, start a new topic and refer back with a link.