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)

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 no joins between pairs of objects


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

Derive the names of all datasets

Usage

TealData$get_datanames()

Returns

(character vector) with names


Method get_join_keys()

Get JoinKeys object with keys used for joining.

Usage

TealData$get_join_keys()

Returns

(JoinKeys)


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

library(scda)
#> 
adsl_cf <- callable_function(function() synthetic_cdisc_data("latest")$adsl)
adlb_cf <- callable_function(function() synthetic_cdisc_data("latest")$adlb)
adrs_cf <- callable_function(function() synthetic_cdisc_data("latest")$adrs)
adtte_cf <- callable_function(function() synthetic_cdisc_data("latest")$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 = synthetic_cdisc_data("latest")$adae,
  code = "library(scda)\nADAE <- synthetic_cdisc_data(\"latest\")$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 = synthetic_cdisc_data("latest")$adsl,
  code = "library(scda)\nADSL <- synthetic_cdisc_data(\"latest\")$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)
}