【发布时间】:2016-08-13 00:13:36
【问题描述】:
按照this 的回答,我正在尝试创建一个应用程序,该应用程序将根据我将通过 URL 传递给应用程序的值输出绘图
library(shiny)
shinyApp(
ui = fluidPage(
mainPanel(
plotOutput("plot")
)
),
server = function(input, output, session) {
observe({
query <- parseQueryString(session$clientData$url_search)
if (!is.null(query[['text']])) {
n <- query[['text']]
}
})
output$plot <- renderPlot({
# Add a little noise to the cars data
plot(cars[sample(nrow(cars), n), ])
})
}
)
但我不知道应该在哪里/如何存储/传递变量 n 的值,以便将其从 observe() 转移到 renderPlot()。
【问题讨论】: