以下是我在闪亮的应用上遇到的错误。我想获得关于我博客某些页面的网页浏览量的图表。我正在使用RGA(谷歌分析软件包)
Error in .getReactiveEnvironment()$currentContext() :
Operation not allowed without an active reactive context. (You tried to do something that can only be done from inside a reactive expression or observer.)
我的代码是:
#ui.R
shinyUI(fluidPage(
textInput("text", label = h3("City"), value = "Enter city name..."),
hr(),
fluidRow(column(12, tableOutput("table1")))
))
#server.R
shinyServer(function(input, output) {
content_data <- reactive({
ga$getData(id, start.date=Sys.Date()-10, end.date=Sys.Date()-1,
metrics = "ga:pageViews",
dimensions = "ga:day",
filter = paste0("ga:pagePath=@/tp/", input$text))
})
output$table1 <- renderTable[{content_data()}]
})