tests/testthat/helper-api-code-test.R

my_google_api_key <- function() {
  val <- Sys.getenv("google_api_key")
  if (identical(val, "")) {
    cat("`google_api_key` env var has not been set")
  } else {
    return(val)
  }
}

google_api_key<-my_google_api_key()

if (!is.null(google_api_key)) {
   ggmap::register_google(google_api_key)
}

Try the FLightR package in your browser

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

FLightR documentation built on July 6, 2021, 5:08 p.m.