【问题标题】:googleAnalyticsR package cannot coerce type 'closure' to vector of type 'character'googleAnalyticsR 包无法将类型“闭包”强制转换为“字符”类型的向量
【发布时间】:2020-02-16 21:59:56
【问题描述】:

当我运行以下代码时,我没有看到任何错误,并且 Shiny 应用程序按预期呈现和执行。

library(shiny)
library(googleAuthR)

gar_set_client(scopes = c("htps://www.googleapis.com/auth/analytics.readonly"))

library(googleAnalyticsR)

ui <- fluidPage(
  googleAuth_jsUI("auth")
  )

server <- function(input, output, session) {
}

shinyApp(ui = ui, server = server)

但是,当我通过添加 auth 模块运行以后的迭代时,我得到一个强制错误

library(shiny)
    library(googleAuthR)

    gar_set_client(scopes = c("htps://www.googleapis.com/auth/analytics.readonly"))

    library(googleAnalyticsR)

    ui <- fluidPage(
      googleAuth_jsUI("auth")
      )

    server <- function(input, output, session) {

    auth <- callModule(gar_auth_js, "auth")


    }

错误:

2020-02-16 21:41:43> 
options(googleAuthR.scopes.selected=c('https://www.googleapis.com/auth/analytics.readonly'))
options(googleAuthR.client_id='xxx.apps.googleusercontent.com')
options(googleAuthR.client_secret='xxx')
options(googleAuthR.webapp.client_id='xxx.apps.googleusercontent.com')
options(googleAuthR.webapp.client_secret='xxx')

Listening on http://127.0.0.1:1221
Warning: Error in as.character: cannot coerce type 'closure' to vector of type 'character'
  58: sprintf
  57: gettextf
  56: .Deprecated
  55: module
  50: callModule
  49: server [/Users/xxx/xxx/xxx/app.R#60]
Error in as.character(function (input, output, session, message = "Authenticate with your Google account")  : 
  cannot coerce type 'closure' to vector of type 'character'

【问题讨论】:

    标签: r shiny coerce


    【解决方案1】:

    错误是由于弃用: auth &lt;- callModule(gar_auth_js, "auth")

    改为必须使用以下内容。 auth &lt;- callModule(googleAuth_js, "auth")

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 2014-07-13
      • 1970-01-01
      • 1970-01-01
      • 2019-12-11
      • 1970-01-01
      • 2015-07-01
      • 2018-01-30
      • 2018-01-19
      相关资源
      最近更新 更多