0

以下是我在闪亮的应用程序上遇到的错误。我想获得关于我博客某些页面的浏览量的图表。我正在使用 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()}]
 })
4

0 回答 0