knitr::opts_chunk$set(
  collapse = TRUE,
  comment = "#>"
)
library(multilex)

To retrieve the necessary data, you need to provide Google and formr credentials. These credentials are used by the googlesheets4::gs4_auth and formr::formr_connect to access the data we require. These credentials are never stored, and are only used during you R session. You can provide your credentials by running:

ml_connect(google_email = "my@email.com")

This email should be the one you use to access the Participants Google spreadsheet. If you do not provide any email, you will be prompted to introduce one in the console. Next, you will be prompted to introduce the formr password in the console. Once you introduce the right email and password, you will be able to run all the other functions of the multilex package without having to provide your credentials again.

How to securely save your password for future occasions

The keyring package allows to encrypt and save your credentials locally and securely. If ml_connect cannot find the appropriate credentials (maybe it's your first time connecting to the database), it will prompt you to save your password. You will only need to do this once. You can also save your credentials manually from you R console running:

keyring::key_set(
  service = "multilex",
  username = "gonzalo.garciadecastro@upf.edu"
)

Then, introduce your password in the dialogue box that will pop-up, and your credentials will be encrypted and locally saved. The next time you want to connect for MultiLex in your script, use the following code:

my_email <- "gonzalo.garciadecastro@upf.edu"
ml_connect(google_email = my_email)

You will connect to MultiLex without having to type again your password in the console.



gongcastro/multilex documentation built on Oct. 21, 2022, 6:24 p.m.