Skip to contents

[Experimental] Class manages TealDataConnector, TealDatasetConnector and TealDataset objects and aggregate them in one collection. Class also decides whether to launch app before initialize teal application.

Super class

teal.data::TealDataAbstract -> TealData

Methods

Inherited methods


Method new()

Create a new object of TealData class

Usage

TealData$new(..., check = FALSE, join_keys = teal.data::join_keys())

Arguments

...

(TealDataConnector, TealDataset, TealDatasetConnector)
objects

check

(logical) reproducibility check - whether evaluated preprocessing code gives the same objects as provided in arguments. Check is run only if flag is true and preprocessing code is not empty.

join_keys

(JoinKeys) or a single (JoinKeySet)
(optional) object with dataset column relationships used for joining. If empty then an empty JoinKeys object is passed by default.


Method copy()

Creates a copy of the object with keeping valid references between TealDataset and TealDatasetConnector objects

Usage

TealData$copy(deep = FALSE)

Arguments

deep

(logical(1))
argument passed to clone method. If TRUE deep copy is made

Returns

self invisible


Method print()

Prints this TealData.

Usage

TealData$print(...)

Arguments

...

additional arguments to the printing method

Returns

invisibly self


Method get_connectors()

Get data connectors.

Usage

TealData$get_connectors()

Returns

(list) with all TealDatasetConnector or TealDataConnector objects.


Method get_items()

Get all datasets and all dataset connectors

Usage

TealData$get_items(dataname = NULL)

Arguments

dataname

(character value)
name of dataset connector to be returned. If NULL, all connectors are returned.

Returns

list with all datasets and all connectors


Method get_join_keys()

Get join keys between two datasets.

Usage

TealData$get_join_keys(dataset_1, dataset_2)

Arguments

dataset_1

(character) name of first dataset.

dataset_2

(character) name of second dataset.

Returns

(character) named character vector x with names(x) the columns of dataset_1 and the values of (x) the corresponding join keys in dataset_2 or character(0) if no relationship


Method get_parents()

returns the parents list of the datasets.

Usage

TealData$get_parents()

Returns

named (list) of the parents of all datasets.


Method get_ui()

Get a shiny-module UI to render the necessary app to derive TealDataConnector object's data

Usage

TealData$get_ui(id)

Arguments

id

(character) item ID for the shiny module

Returns

the shiny ui function


Method get_server()

Get a shiny-module server to render the necessary app to derive TealDataConnector object's data

Usage

TealData$get_server()

Returns

shiny server module.


Method launch()

Launch an app that allows to run the user-interfaces of all TealDataConnector and TealDatasetConnector modules

This piece is mainly used for debugging.

Usage

TealData$launch()


Method mutate_join_keys()

Change join_keys for a given pair of dataset names

Usage

TealData$mutate_join_keys(dataset_1, dataset_2, val)

Arguments

dataset_1, dataset_2

(character) datasets for which join_keys are to be returned

val

(named character) column names used to join

Returns

(self) invisibly for chaining


Method check_metadata()

Check there is consistency between the datasets and join_keys

Usage

TealData$check_metadata()

Returns

raise and error or invisible TRUE


Method clone()

The objects of this class are cloneable with this method.

Usage

TealData$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

adsl_cf <- callable_function(teal.data::example_cdisc_data)$set_args(list(dataname = "ADSL"))
adlb_cf <- callable_function(teal.data::example_cdisc_data)$set_args(list(dataname = "ADLB"))
adrs_cf <- callable_function(teal.data::example_cdisc_data)$set_args(list(dataname = "ADRS"))
adtte_cf <- callable_function(teal.data::example_cdisc_data)$set_args(list(dataname = "ADTTE"))
x1 <- cdisc_dataset_connector("ADSL", adsl_cf, keys = get_cdisc_keys("ADSL"))
x2 <- cdisc_dataset_connector("ADRS", adrs_cf, keys = get_cdisc_keys("ADRS"))
x3 <- cdisc_dataset(
  dataname = "ADAE",
  x = teal.data::example_cdisc_data("ADAE"),
  code = "library(teal.data)\nADAE <- teal.data::example_cdisc_data(\"ADAE\")"
)
x4 <- cdisc_dataset_connector("ADTTE", adtte_cf, keys = get_cdisc_keys("ADTTE"))
tc <- teal.data:::TealData$new(x1, x2, x3, x4)
tc$get_datanames()
#> [1] "ADSL"  "ADRS"  "ADAE"  "ADTTE"
if (FALSE) {
tc$launch()
get_datasets(tc) # equivalent to tc$get_datasets()
tc$get_dataset("ADAE")
tc$check()
}

x <- cdisc_dataset(
  dataname = "ADSL",
  x = teal.data::example_cdisc_data("ADSL"),
  code = "library(teal.data)\nADSL <- teal.data::example_cdisc_data(\"ADSL\")"
)

x2 <- cdisc_dataset_connector("ADTTE", adtte_cf, keys = get_cdisc_keys("ADTTE"))
tc <- teal.data:::TealData$new(x, x2)
if (FALSE) {
# This errors as we have not pulled the data
# tc$get_datasets()
# pull the data and then we can get the datasets
tc$launch()
tc$get_datasets()
get_raw_data(tc)
}