Learn R Programming

gtrendsR (version 1.3.5)

gconnect: Connect to Google account

Description

The resulting connection object is also stored in the package-local environment from which the (internal) helper function .getDefaultConnection() retrieves it as needed.

Usage

gconnect(usr = NULL, psw = NULL, verbose = FALSE)

.getDefaultConnection()

Arguments

usr

User name (ex.: yourmail@gmail.com); alternatively the environment variable GOOGLE_USER as well as options("google.user") can be used to supply the user name.

psw

Account password; alternatively the environment variable GOOGLE_PASSWORD as well as options("google.password") can be used to supply the password.

verbose

Logical for displaying additional information

Value

A libcurl handle is returned (invisibly).

Details

If the environment variables GOOGLE_USER and GOOGLE_PASSWORD are set, they will be retrieved in case no argument has been supplied. Similarly, the environment variable options("google.user") or options("google.password") can be used. Lastly, if the environment variable GOOGLE_AUTOCONNECT is set to (the text string) ‘TRUE’, or the the R option options("google.autoconnect") is set to ‘TRUE’ then the connection is automatically made at package load.

Examples

Run this code
# NOT RUN {
# use with explicit arguments
session <- gconnect("usr@gmail.com", "psw")

# use with arguments stored in env.var or options()
# this is preferred for scripts shared with others who
# can place their secret password in a file only they know
session <- gconnect("usr@gmail.com", "psw")
# }

Run the code above in your browser using DataLab