R 将对象列表转换为具有动态UI的标记列表时出错

R 将对象列表转换为具有动态UI的标记列表时出错,r,shiny,R,Shiny,我正在使用Shinny的renerUI根据问题的指示动态创建UI对象 我得到以下错误 Error in if (!grepl(pattern, text)) return(text) : argument is of length zero 读完后我知道问题出在这一行 # Convert the list to a tagList do.call(tagList, plot_output_list) 但我正在做解决方案所建议的事情。 谢谢你的帮助 代码 Server.r shinySe

我正在使用Shinny的renerUI根据问题的指示动态创建UI对象

我得到以下错误

Error in if (!grepl(pattern, text)) return(text) : 
  argument is of length zero
读完后我知道问题出在这一行

# Convert the list to a tagList
do.call(tagList, plot_output_list)
但我正在做解决方案所建议的事情。 谢谢你的帮助

代码

Server.r

shinyServer(function(input, output) {

    # Create an environment for storing data
    symbol_env <- new.env()

    output$plots <- renderUI({

        if (input$goButton == 0) 
            return()

        if (loaded_index != input$chosen_index) {

            # ... alot of code to generate data.frames and plots 

            output[["summary"]] <- renderPlot(grid.arrange(g1,g2,g3,g4,g5,nrow=1))

            for (i in 1:length(results)) {
                # Need local so that each item gets its own number. Without it, the value
                # of i in the renderPlot() will be the same across all instances, because
                # of when the expression is evaluated.
                local({
                    my_i <- i
                    plotname <- object_name("plot", names(results[my_i]))
                        output[[plotname]] <- renderPlot({
                            showme_plot(results[[names(results[my_i])]]$data , period = DEFAULT_TIME_PERIOD)})

                    tablename <- object_name("table", names(results[my_i]))
                        output[[tablename]] <- renderTable({
                            make_summary(names(results[my_i]))})
                    })
            }
        }

        plot_output_list <- list()

        # Graphical Summary     
        plot_output_list[["summary"]] <- tags$div(class="summary" , plotOutput("summary")) 

        # The List
        for (symbol in names(results))
            plot_output_list[[symbol]] <- 
                tags$div(class = "container" ,
                    tags$div(class = "name"  , name(symbol)),
                    tags$div(class = "stats" , tableOutput(object_name("table", symbol))) , 
                    tags$div(class = "plot"  , plotOutput(object_name("plot", symbol), height = 530)))

        print("Plot structure defined")

        # Convert the list to a tagList
        do.call(tagList, plot_output_list)
    })
})
require(shinyIncubator) 
shinyUI(
    bootstrapPage(
        tags$script(src = "keyboard_scroller.js") , 
        tags$link(rel="stylesheet" , type="text/css" , href="custom.css") ,
        actionButton("goButton", "Go!") , 
        selectInput("chosen_index" , "INDEX: " , list("A" = '1' , "B" = '2')) ,
        # This is the dynamic UI for the plots
        uiOutput("plots")
))

我想一个问题是
plot\u output\u list
不应该按字符串索引,而是按数字索引,即
plot\u output\u list[[symbol]]