Skip to contents

[Stable] Any data.frame object can be stored inside this object.

The difference compared to TealDataset class 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::TealDataset -> CDISCTealDataset

Methods

Inherited methods


Method new()

Create a new object of CDISCTealDataset class

Usage

CDISCTealDataset$new(
  dataname,
  x,
  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

x

(data.frame)

keys

(character)
vector with primary keys

parent

optional, (character)
parent dataset name

code

(character)
A character string defining the code needed to produce the data set in x

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 is 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 a dataset with its current attributes This is useful way to have access to class initialize method basing on class object

Usage

CDISCTealDataset$recreate(
  dataname = self$get_dataname(),
  x = self$get_raw_data(),
  keys = self$get_keys(),
  parent = self$get_parent(),
  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

(character)
vector with primary keys

parent

optional, (character)
parent dataset name

code

(character)
A character string defining the code needed to produce the data set in x

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 is 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 CDISCTealDataset class


Method get_attrs()

Get all dataset attributes

Usage

CDISCTealDataset$get_attrs()

Returns

(named list) with dataset attributes


Method get_parent()

Get parent dataset name

Usage

CDISCTealDataset$get_parent()

Returns

(character) indicating parent dataname


Method set_parent()

Set parent dataset name

Usage

CDISCTealDataset$set_parent(parent)

Arguments

parent

(character) indicating parent dataname

Returns

(self) invisibly for chaining


Method clone()

The objects of this class are cloneable with this method.

Usage

CDISCTealDataset$clone(deep = FALSE)

Arguments

deep

Whether to make a deep clone.

Examples

x <- cdisc_dataset(
  dataname = "XYZ",
  x = data.frame(x = c(1, 2), y = c("a", "b"), stringsAsFactors = FALSE),
  keys = "y",
  parent = "ABC",
  code = "XYZ <- data.frame(x = c(1, 2), y = c('aa', 'bb'),
                            stringsAsFactors = FALSE)",
  metadata = list(type = "example")
)

x$ncol
#> NULL
x$get_code()
#> [1] "XYZ <- data.frame(x = c(1, 2), y = c(\"aa\", \"bb\"), stringsAsFactors = FALSE)"
x$get_dataname()
#> [1] "XYZ"
x$get_keys()
#> [1] "y"
x$get_parent()
#> [1] "ABC"