例如:
data_cbs <- reactive({
"code"
})
model <- reactive({
data <- data_cbs()
+ "code"
})是否可以在R闪亮中使用以下结构?
也许重要的是要知道,data_cbs()和model是由3-4个“of”语句组成的。
发布于 2016-11-17 20:03:59
这里有一个单独的脚本示例来说明这个方法确实有效,并且可以玩一玩:
# Global variables can go here
n <- 200
# Define the UI
ui <- bootstrapPage(
checkboxInput('random', 'randomize'),
plotOutput('plot')
)
# Define the server code
server <- function(input, output) {
checkRandom <- reactive({
if( input$random ){
data <- runif(n)
}else {
data <- seq(1, n)
}
return(data)
})
output$plot <- renderPlot({
plot(checkRandom())
})
}
# Return a Shiny app object
shinyApp(ui = ui, server = server)https://stackoverflow.com/questions/40632625
复制相似问题