如何接受用户输入并将其存储为 server.R 中的环境字符串?
这是一个示例(产生错误):
library(shiny)
# Define the UI
n <- 100
ui <- bootstrapPage(
numericInput('n', 'Number of obs', n),
textOutput('count_new')
)
# Define the server code
server <- function(input, output) {
count <- as.numeric(renderText({input$n}))
output$count_new <- renderText({count/10})
}
# Return a Shiny app object
shinyApp(ui = ui, server = server)