Skip to contents

[Experimental] Any MultiAssayExperiment object can be stored inside this MAETealDataset. Some attributes like colnames, dimension or column names for a specific type will be automatically derived.

[Stable] Any data.frame object can be stored inside this object. Some attributes like colnames, dimension or column names for a specific type will be automatically derived.

Super class

teal.data::TealDataset -> MAETealDataset

Methods

Inherited methods


Method new()

Create a new object of MAETealDataset class

Usage

MAETealDataset$new(
  dataname,
  x,
  keys = character(0),
  code = character(0),
  label = character(0),
  vars = list(),
  metadata = NULL
)

Arguments

dataname

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

x

(MultiAssayExperiment)

keys

optional, (character)
vector with primary keys

code

(character or CodeClass)
A character string defining the code needed to produce the data set in x. initialize() and recreate() accept code as CodeClass also which is needed to preserve the code uniqueness and correct order.

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 or NULL)
Field containing metadata about the dataset. Each element of the list should be atomic and length one.


Method check()

Check to determine if the raw data is reproducible from the get_code() code.

Usage

MAETealDataset$check()

Returns

TRUE if the dataset generated from evaluating the get_code() code is identical to the raw data, else FALSE.


Method check_keys()

Check if keys has been specified correctly for dataset. Set of keys should distinguish unique rows or be character(0).

Usage

MAETealDataset$check_keys(keys = private$.keys)

Arguments

keys

optional, (character)
vector with primary keys

Returns

TRUE if dataset has been already pulled, else FALSE


Method get_colnames()

Derive the column names

Usage

MAETealDataset$get_colnames()

Returns

character vector.


Method get_column_labels()

Derive the column labels

Usage

MAETealDataset$get_column_labels()

Returns

character vector.


Method get_ncol()

Get the number of columns of the data

Usage

MAETealDataset$get_ncol()

Returns

numeric vector


Method get_nrow()

Get the number of rows of the data

Usage

MAETealDataset$get_nrow()

Returns

numeric vector


Method get_rownames()

Derive the row names

Usage

MAETealDataset$get_rownames()

Returns

character vector.


Method print()

Prints this MAETealDataset.

Usage

MAETealDataset$print(...)

Arguments

...

additional arguments to the printing method

Returns

invisibly self


Method clone()

The objects of this class are cloneable with this method.

Usage

MAETealDataset$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Active bindings

raw_data

The data.frame behind this R6 class

data

The data.frame behind this R6 class

var_names

The column names of the data

Methods


Method new()

Create a new object of TealDataset class

Usage

TealDataset$new(
  dataname,
  x,
  keys = character(0),
  code = character(0),
  label = character(0),
  vars = list(),
  metadata = NULL
)

Arguments

dataname

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

x

(data.frame)

keys

optional, (character)
Vector with primary keys

code

(character)
A character string defining the code needed to produce the data set in x. initialize() and recreate() accept code as CodeClass also which is needed to preserve the code uniqueness and correct order.

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 or NULL)
Field containing metadata about the dataset. Each element of the list should be atomic and length one.


Method recreate()

Recreate this TealDataset with its current attributes.

Usage

TealDataset$recreate(
  dataname = self$get_dataname(),
  x = self$get_raw_data(),
  keys = self$get_keys(),
  code = private$code,
  label = self$get_dataset_label(),
  vars = list(),
  metadata = self$get_metadata()
)

Arguments

dataname

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

x

(data.frame)

keys

optional, (character)
Vector with primary keys

code

(character)
A character string defining the code needed to produce the data set in x. initialize() and recreate() accept code as CodeClass also which is needed to preserve the code uniqueness and correct order.

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 or NULL)
Field containing metadata about the dataset. Each element of the list should be atomic and length one.

Returns

a new object of the TealDataset class


Method print()

Prints this TealDataset.

Usage

TealDataset$print(...)

Arguments

...

additional arguments to the printing method

Returns

invisibly self


Method get_dataset()

Performs any delayed mutate calls before returning self.

Usage

TealDataset$get_dataset()

Returns

dataset (TealDataset)


Method get_attrs()

Get all dataset attributes

Usage

TealDataset$get_attrs()

Returns

(named list) with dataset attributes


Method get_raw_data()

Derive the raw data frame inside this object

Usage

TealDataset$get_raw_data()

Returns

data.frame


Method get_numeric_colnames()

Derive the names of all numeric columns

Usage

TealDataset$get_numeric_colnames()

Returns

character vector.


Method get_character_colnames()

Derive the names of all character columns

Usage

TealDataset$get_character_colnames()

Returns

character vector.


Method get_factor_colnames()

Derive the names of all factor columns

Usage

TealDataset$get_factor_colnames()

Returns

character vector.


Method get_colnames()

Derive the column names

Usage

TealDataset$get_colnames()

Returns

character vector.


Method get_column_labels()

Derive the column labels

Usage

TealDataset$get_column_labels()

Returns

character vector.


Method get_ncol()

Get the number of columns of the data

Usage

TealDataset$get_ncol()

Returns

numeric vector


Method get_nrow()

Get the number of rows of the data

Usage

TealDataset$get_nrow()

Returns

numeric vector


Method get_rownames()

Derive the row names

Usage

TealDataset$get_rownames()

Returns

character vector.


Method get_row_labels()

Derive the row labels

Usage

TealDataset$get_row_labels()

Returns

character vector.


Method get_dataname()

Derive the name which was formerly called dataname

Usage

TealDataset$get_dataname()

Returns

character name of the dataset


Method get_datanames()

Derive the dataname

Usage

TealDataset$get_datanames()

Returns

character name of the dataset


Method get_dataset_label()

Derive the label which was former called datalabel

Usage

TealDataset$get_dataset_label()

Returns

character label of the dataset


Method get_keys()

Get primary keys of dataset

Usage

TealDataset$get_keys()

Returns

(character vector) with dataset primary keys


Method get_metadata()

Get metadata of dataset

Usage

TealDataset$get_metadata()

Returns

(named list)


Method get_join_keys()

Get JoinKeys object with keys used for joining.

Usage

TealDataset$get_join_keys()

Returns

(JoinKeys)


Method get_hash()

Returns the string representation of the raw data hashed with the MD5 hash algorithm.

Usage

TealDataset$get_hash()

Returns

character the hash of the raw data


Method get_var_r6()

Get the list of dependencies that are TealDataset or TealDatasetConnector objects

Usage

TealDataset$get_var_r6()

Returns

list


Method reassign_datasets_vars()

Overwrites TealDataset or TealDatasetConnector dependencies of this TealDataset with those found in datasets. Reassignment refers only to the provided datasets, other vars remains the same.

Usage

TealDataset$reassign_datasets_vars(datasets)

Arguments

datasets

(named list of TealDataset(s) or TealDatasetConnector(s))
objects with valid pointers.

Details

Reassign vars in this object to keep references up to date after deep clone. Update is done based on the objects passed in datasets argument. Overwrites dependencies with names matching the names of the objects passed in datasets.

Returns

NULL invisible

Examples

test_dataset <- teal.data:::TealDataset$new(
  dataname = "iris",
  x = iris,
  vars = list(dep = teal.data:::TealDataset$new("iris2", iris))
)
test_dataset$reassign_datasets_vars(
  list(iris2 = teal.data:::TealDataset$new("iris2", head(iris)))
)


Method set_dataset_label()

Set the label for the dataset

Usage

TealDataset$set_dataset_label(label)

Arguments

label

(character)
Label to describe the dataset

Returns

(self) invisibly for chaining


Method set_keys()

Set new keys

Usage

TealDataset$set_keys(keys)

Arguments

keys

optional, (character)
Vector with primary keys

Returns

(self) invisibly for chaining.


Method set_join_keys()

set join_keys for a given dataset and object

Usage

TealDataset$set_join_keys(x)

Arguments

x

list of JoinKeySet objects (which are created using the join_key function) or single JoinKeySet objects

Returns

(self) invisibly for chaining


Method merge_join_keys()

merge input join key with join key inside of object

Usage

TealDataset$merge_join_keys(x)

Arguments

x

list of JoinKeys objects or single JoinKeys object

Returns

(self) invisibly for chaining


Method mutate_join_keys()

mutate the join_keys for a given dataset and object

Usage

TealDataset$mutate_join_keys(dataset, val)

Arguments

dataset

(character) dataset for which join_keys are to be set against self

val

(named character) column names used to join

Returns

(self) invisibly for chaining


Method set_vars()

Adds variables which code depends on

Usage

TealDataset$set_vars(vars)

Arguments

vars

(named list) contains any R object which code depends on

Returns

(self) invisibly for chaining


Method set_code()

Sets reproducible code

Usage

TealDataset$set_code(code)

Arguments

code

(character)
A character string defining the code needed to produce the data set in x. initialize() and recreate() accept code as CodeClass also which is needed to preserve the code uniqueness and correct order.

Returns

(self) invisibly for chaining


Method get_code()

Get code to get data

Usage

TealDataset$get_code(deparse = TRUE)

Arguments

deparse

(logical) whether return deparsed form of a call

Returns

optionally deparsed call object


Method get_code_class()

Get internal CodeClass object

Usage

TealDataset$get_code_class(nodeps = FALSE)

Arguments

nodeps

(logical(1)) whether CodeClass should not contain the code of the dependent vars the mutate

Returns

CodeClass


Method get_mutate_code_class()

Get internal CodeClass object

Usage

TealDataset$get_mutate_code_class()

Returns

CodeClass


Method get_vars()

Get internal vars object

Usage

TealDataset$get_vars()

Returns

list


Method get_mutate_vars()

Get internal mutate_vars object

Usage

TealDataset$get_mutate_vars()

Returns

list


Method is_mutate_delayed()

Whether mutate code has delayed evaluation.

Usage

TealDataset$is_mutate_delayed()

Returns

logical


Method mutate()

Mutate dataset by code

Usage

TealDataset$mutate(code, vars = list(), force_delay = FALSE)

Arguments

code

(CodeClass) or (character) R expressions to be executed

vars

a named list of R objects that code depends on to execute

force_delay

(logical) used by the containing TealDatasetConnector object

Either code or script must be provided, but not both.

Returns

(self) invisibly for chaining


Method check()

Check to determine if the raw data is reproducible from the get_code() code.

Usage

TealDataset$check()

Returns

TRUE if the dataset generated from evaluating the get_code() code is identical to the raw data, else FALSE.


Method check_keys()

Check if keys has been specified correctly for dataset. Set of keys should distinguish unique rows or be character(0).

Usage

TealDataset$check_keys(keys = private$.keys)

Arguments

keys

optional, (character)
Vector with primary keys

Returns

TRUE if dataset has been already pulled, else FALSE


Method is_pulled()

Check if dataset has already been pulled.

Usage

TealDataset$is_pulled()

Returns

TRUE if dataset has been already pulled, else FALSE


Method clone()

The objects of this class are cloneable with this method.

Usage

TealDataset$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples


## ------------------------------------------------
## Method `TealDataset$reassign_datasets_vars`
## ------------------------------------------------

test_dataset <- teal.data:::TealDataset$new(
  dataname = "iris",
  x = iris,
  vars = list(dep = teal.data:::TealDataset$new("iris2", iris))
)
test_dataset$reassign_datasets_vars(
  list(iris2 = teal.data:::TealDataset$new("iris2", head(iris)))
)