I am new to shiny, and building an app based on the answer to this question
But there is a section in the code I do not understand, and can not find more insight in shiny documents. In the code section below (part of the example), why the use of local? and the ii <- i assignment?
My apologies if this is not a proper stackoverflow question! this is my first one..
renderPlots <- function(n, input, output, prefix="plot") {
for (i in seq.int(n)) {
local({
ii <- i # need i evaluated here
## These would be your 10 plots instead
output[[sprintf('%s_%g', prefix, ii)]] <- renderPlot({
ggplot(dat, aes_string(x='time', y=input$var)) + rndmPlot(input)
})
})
}
}