opal_tables_pull: Download tables from an Opal project as a dossier

View source: R/09-opal_functions.R

opal_tables_pullR Documentation

Download tables from an Opal project as a dossier

Description

Downloads a dossier or dataset from an Opal environment to the local environment. This is a wrapper function foropalr::opal.table_get() and opalr::opal.table_dictionary_get().

Usage

opal_tables_pull(
  opal,
  project,
  table_list = NULL,
  content = c("dataset", "data_dict"),
  keep_as_dossier = TRUE,
  .remove_id = FALSE
)

Arguments

opal

Opal login attributes.

project

A character string specifying the Opal project name.

table_list

A vector character string specifying Opal tables name.

content

A vector of character string which indicates if the function returns a dataset, or data dictionary. Default is 'dataset'.

keep_as_dossier

whether to return a dossier or a dataset if there is only one table. TRUE by default, if FALSE returns dataset.

.remove_id

whether to return the id column created in Opal or not. TRUE by default.

Details

Opal is the OBiBa application for data management, and Opal environments can be integrated with RStudio environments using the package opalr. The user must have adequate credentials to interact with a specific Opal environment. Some function errors produced may be associated with the handler or Opal read/write permissions.

Value

Objects (tibbles and list of tibbles) representing tables and their respective data dictionary.

See Also

Please see Opal documentation for complete documentation. madshapR::as_dossier() madshapR::as_dataset() madshapR::as_data_dict_mlstr()

Examples

## Not run: 

library(opalr)
opal <- 
 opal.login('administrator','password',
   url ='https://opal-demo.obiba.org/')
   
# use DEMO_files provided by the package
library(madshapR)
library(stringr)

dossier <- 
  DEMO_files[str_detect(names(DEMO_files),"dataset_MELBOURNE")]

tempdir <- basename(tempdir())
try(opal_project_create(opal, tempdir))

try(
  opal_tables_push(
  opal, dossier,project_name = tempdir, .force = TRUE, .overwrite = TRUE))
  
###### Example pull a table from a project.
try(
  opal_tables_pull(
  opal,project = tempdir,table_list = 'dataset_MELBOURNE_1'))


## End(Not run)


mlstrOpalr documentation built on Oct. 11, 2023, 5:15 p.m.