Пакет googleAnalyticsR не может привести тип «замыкание» к вектору типа «символ» - PullRequest
0 голосов
/ 17 февраля 2020

Когда я запускаю следующий код, я не вижу ошибок, и приложение 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'

1 Ответ

0 голосов
/ 24 февраля 2020

Ошибка из-за устаревания: auth <- callModule(gar_auth_js, "auth")

Вместо этого должно использоваться следующее. auth <- callModule(googleAuth_js, "auth")

...