Skip to contents

[Stable] Objects of this class store the connection function to fetch a single dataset.

The difference compared to TealDatasetConnector is a parent field that indicates name of the parent dataset. Note that the parent field might be empty (i.e. character(0)).

Super class

teal.data::TealDatasetConnector -> CDISCTealDatasetConnector

Methods

Inherited methods


Method new()

Create a new TealDatasetConnector object. Set the pulling function CallableFunction which returns a data.frame, e.g. by reading from a function or creating it on the fly.

Usage

CDISCTealDatasetConnector$new(
  dataname,
  pull_callable,
  keys,
  parent,
  code = character(0),
  label = character(0),
  vars = list(),
  metadata = NULL
)

Arguments

dataname

(character)
A given name for the dataset it may not contain spaces

pull_callable

(CallableFunction)
function with necessary arguments set to fetch data from connection.

keys

(character)
vector of dataset primary keys column names

parent

optional, (character)
parent dataset name

code

(character)
A character string defining code to modify raw_data from this dataset. To modify current dataset code should contain at least one assignment to object defined in dataname argument. For example if dataname = ADSL example code should contain ADSL <- <some R code>. Can't be used simultaneously with script

label

(character)
Label to describe the dataset.

vars

(named list))
In case when this object code depends on other TealDataset object(s) or other constant value, this/these object(s) should be included as named element(s) of the list. For example if this object code needs ADSL object we should specify vars = list(ADSL = <adsl object>). It's recommended to include TealDataset or TealDatasetConnector objects to the vars list to preserve reproducibility. Please note that vars are included to this object as local vars and they cannot be modified within another dataset.

metadata

(named list, NULL or CallableFunction)
Field containing either the metadata about the dataset (each element of the list should be atomic and length one) or a CallableFuntion to pull the metadata from a connection. This should return a list or an object which can be converted to a list with as.list.


Method get_parent()

Get parent dataset name

Usage

CDISCTealDatasetConnector$get_parent()

Returns

(character) indicating parent dataname


Method pull()

Pull the data

Read or create the data using pull_callable specified in the constructor.

Usage

CDISCTealDatasetConnector$pull(args = NULL, try = FALSE)

Arguments

args

(NULL or named list)
additional dynamic arguments for pull function. args can be omitted if pull_callable from constructor already contains all necessary arguments to pull data. One can try to execute pull_callable directly by x$pull_callable$run() or to get code using x$pull_callable$get_code(). args specified in pull are used temporary to get data but not saved in code.

try

(logical value)
whether perform function evaluation inside try clause

Returns

self invisibly for chaining.


Method clone()

The objects of this class are cloneable with this method.

Usage

CDISCTealDatasetConnector$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.