opal_tables_push: Upload datasets into an Opal environment as tables in an Opal...

View source: R/09-opal_functions.R

opal_tables_pushR Documentation

Upload datasets into an Opal environment as tables in an Opal project

Description

Uploads a dossier or dataset from the local environment to an Opal environment. This is a wrapper function for opalr::opal.table_create(), opalr::opal.table_save() and opalr::opal.table_dictionary_update().

Usage

opal_tables_push(
  opal,
  dossier = NULL,
  data_dict = NULL,
  dataset = NULL,
  table_name = NULL,
  project_name,
  .force = FALSE,
  .overwrite = FALSE
)

Arguments

opal

Opal login attributes.

dossier

List of tibble, each of them being datasets.

data_dict

A list of tibble(s) representing meta data of an associated dataset. Automatically generated if not provided.

dataset

A tibble identifying the input dataset observations associated to its data dictionary.

table_name

A character string specifying an Opal table name.

project_name

A character string specifying the Opal project name.

.force

If the destination already exists, stop with an informative message if this flag is FALSE (default).

.overwrite

If the destination table already exists, it will be replaced (deleted, re-created with associated permissions reinstated and then imported). Otherwise the table will be updated (data dictionaries merge may conflict). Default is FALSE.*

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

A table or table(s) in Opal.

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))

# push a table in a project.
try( 
  opal_tables_push(
  opal,
  dataset = dossier$dataset_MELBOURNE_1,
  table_name = 'dataset_MELBOURNE_1',
  project_name = tempdir,
  .force = TRUE,
  .overwrite = TRUE))


## End(Not run)


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