Skip to contents

Utility to download / load datasets from pin board

Usage

dataload_from_pins(
  varnames = .arrow_ds_names[1:3],
  boardfolder = "Mark",
  auth = "auto",
  server = "https://rstudio-connect.dmap-stage.aws.epa.gov",
  folder_local_source = NULL,
  envir = globalenv(),
  justchecking = FALSE,
  ignorelocal = FALSE,
  silent = FALSE,
  return_data_table = TRUE,
  onAttach = FALSE
)

Arguments

varnames

character vector of names of R objects to get from board, or set this to "all" to load all of them

boardfolder

if needed to specify a different folder than default

auth

See help documentation for pins::board_connect()

server

if needed to specify a server other than default (which might be stored in envt variable CONNECT_SERVER or be registered via the rsconnect package). Note if auth = "envvar" then it looks for CONNECT_SERVER to get name of server which needs to be the full url starting with https:// - see help for board_connect

folder_local_source

path of local folder to look in for locally saved copies in case pins board is not reachable by user.

envir

if needed to specify environment other than default, e.g., globalenv() or parent.frame()

justchecking

can set to TRUE to just see a list of what pins are stored in that board

ignorelocal

set it to TRUE to avoid 1st checking local disk for copies of files

silent

set to TRUE to suppress cat() msgs to console

return_data_table

whether the read_ipc_file() should return a data.table (T, the default), or arrow (F). Passed to dataload_from_local()

onAttach

Indicates whether the function is being called from onAttach. IF so, it will download all arrow files if user cannot connect to PINS board

Value

If justchecking = FALSE,

returns vector of names of objects now in memory in specified envir, either because

  1. already in memory or

  2. loaded from local disk or

  3. successfully downloaded.

If justchecking = TRUE, however,

returns vector of names of ALL objects found in specified pin board (or NULL if cannot connect)

regardless of whether they are already in the environment, and

regardless of whether they were specified among varnames, or are related to EJAM at all.

Details

This does work if on VPN and if credentials already set up for the user doing this:

board <- pins::board_connect(auth = "rsconnect")

This does work if that is true plus the two environment variables were created:

board <- pins::board_connect(auth = 'manual',

  server = Sys.getenv("CONNECT_SERVER"),

  key = Sys.getenv("CONNECT_API_KEY")

)

after Sys.setenv(CONNECT_SERVER = "https://rstudio-connect.dmap-stage.aws.... etc.")



and   Sys.setenv(CONNECT_API_KEY =  correct-API-key-goes-here  )