parents: Get and set parents in 'join_keys' object

View source: R/join_keys-parents.R

parentsR Documentation

Get and set parents in join_keys object

Description

parents() facilitates the creation of dependencies between datasets by assigning a parent-child relationship.

Usage

parents(x)

## S3 method for class 'join_keys'
parents(x)

## S3 method for class 'teal_data'
parents(x)

parents(x) <- value

## S3 replacement method for class 'join_keys'
parents(x) <- value

## S3 replacement method for class 'teal_data'
parents(x) <- value

parent(x, dataset_name)

Arguments

x

(join_keys or teal_data) object that contains "parents" information to retrieve or manipulate.

value

(⁠named list⁠) of character vectors.

dataset_name

(character(1)) Name of dataset to query on their parent.

Details

Each element is defined by a list element, where list("child" = "parent").

Value

a list of character representing the parents.

For parent(x, dataset_name) returns NULL if parent does not exist.

Methods (by class)

  • parents(join_keys): Retrieves parents of join_keys object.

  • parents(teal_data): Retrieves parents of join_keys inside teal_data object.

Functions

  • parents(x) <- value: Assignment of parents in join_keys object.

  • parents(join_keys) <- value: Assignment of parents of join_keys object.

  • parents(teal_data) <- value: Assignment of parents of join_keys inside teal_data object.

  • parent(): Getter for individual parent.

See Also

join_keys()

Examples

# Get parents of join_keys ---

jk <- default_cdisc_join_keys["ADEX"]
parents(jk)
# Get parents of join_keys inside teal_data object ---

td <- teal_data(
  ADSL = rADSL,
  ADTTE = rADTTE,
  ADRS = rADRS,
  join_keys = default_cdisc_join_keys[c("ADSL", "ADTTE", "ADRS")]
)
parents(td)
# Assignment of parents ---

jk <- join_keys(
  join_key("ds1", "ds2", "id"),
  join_key("ds5", "ds6", "id"),
  join_key("ds7", "ds6", "id")
)

parents(jk) <- list(ds2 = "ds1")

# Setting individual parent-child relationship

parents(jk)["ds6"] <- "ds5"
parents(jk)["ds7"] <- "ds6"
# Assignment of parents of join_keys inside teal_data object ---

parents(td) <- list("ADTTE" = "ADSL") # replace existing
parents(td)["ADRS"] <- "ADSL" # add new parent
# Get individual parent ---

parent(jk, "ds2")
parent(td, "ADTTE")

teal.data documentation built on May 29, 2024, 8:03 a.m.