R/options.R

Defines functions .onAttach .onLoad

.onLoad <- function(libname, pkgname) {

  op <- options()
  op.googleLanguageR <- list(
    googleAuthR.scopes.selected = c("https://www.googleapis.com/auth/cloud-language",
                                    "https://www.googleapis.com/auth/cloud-platform")
  )

  toset <- !(names(op.googleLanguageR) %in% names(op))

  if(any(toset)) options(op.googleLanguageR[toset])

  invisible()

}

.onAttach <- function(libname, pkgname){

  needed <- c("https://www.googleapis.com/auth/cloud-language",
              "https://www.googleapis.com/auth/cloud-platform")

  googleAuthR::gar_attach_auto_auth(needed,
                                    environment_var = "GL_AUTH")

  invisible()

}

Try the googleLanguageR package in your browser

Any scripts or data that you put into this service are public.

googleLanguageR documentation built on April 19, 2020, 3:58 p.m.