How to dynamically insert module basded on uploaded data?

The uploaded data could include several data set for plotting.

I have created a module, which is to take data and ggplot.

I do not know how to dynamically insert UI (module) based on user's data.

# server.R
function(input, output, session){
    
    # data process
    dat.with.unkn <- reactive ({
        # get data from user's upload
    })
    
    # insert UI (module)
    observeEvent(input$plot.button, {
        a <- lapply(names(dat.with.unkn), function(indx){
          id <- paste0("id_", indx)
          insertUI(selector = "#placeholder", where = "beforeBegin", ui = heatmapUI(id) )
        })
    })
    # module server
    # because I do not know how many data set will be uploaded, 
    # so I have to loop through the dat.with.unkn with lapply.
    # But dat.with.unkn is an reactive value, it is not OK to be put here I guess.
    lapply(names(dat.with.unkn), function(x){
      id <- paste0("id_", indx)
      dat <- dat.with.unkn[[indx]]
      headmapServer(id, dat)
    })
}



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.