R:For循环仅在列表中保存1次迭代

R:For循环仅在列表中保存1次迭代,r,shiny,R,Shiny,各位 我正在用Shinny R编写一个模拟应用程序,我被困在for循环中 基本上,在一个被动函数中,我调用了一个函数,该函数通过几个其他函数循环,如下所示: 在server.R中: output.addiction <- reactive ({ SimulateMultiple(input$no.simulations, vectors(), parameters(), input$S.plus, input$q,

各位

我正在用Shinny R编写一个模拟应用程序,我被困在for循环中

基本上,在一个被动函数中,我调用了一个函数,该函数通过几个其他函数循环,如下所示:

在server.R中:

output.addiction <- reactive ({
                SimulateMultiple(input$no.simulations, vectors(), parameters(), input$S.plus, input$q,
                                 input$weeks, input$d, list.output)  
        })

output.addiction当我从中编辑函数中的代码时,问题自行解决了

output.addition <- c(list.output, list(output.w.success))  # adds the new data to the list
        return(output.addition)

output.addition初始化
output.addicient
外部for循环,然后在此行中添加
[i]
undex:
output.addicient[i]可能的重复
BuildOutputList <- function (df.output, simulation, list.output) {
        addiction <- simulation$addiction

        output.w.success <- list(df.output, addiction)  # includes success data
        output.addition <- c(list.output, list(output.w.success))  # adds the new data to the list
        return(output.addition)
}
output.addition <- c(list.output, list(output.w.success))  # adds the new data to the list
        return(output.addition)
list.output <- c(list.output, list(output.w.success))  # adds the new data to the list
        return(list.output)