R6 Class to store relationships for joining datasets
JoinKeys.Rd
This class stores symmetric links between pairs of key-values
(e.g. column A of dataset X can be joined with column B of dataset Y). This relationship
is more general than the SQL foreign key relationship which also imposes constraints on the values
of these columns.
Methods
Method split()
Split the current JoinKeys object into a named list of join keys objects with an element for each dataset
Method merge()
Merging a list (or one) of JoinKeys objects into the current JoinKeys object
Method get()
Get join keys between two datasets.
Method mutate()
Change join_keys for a given pair of dataset names (or add join_keys for given pair if it does not exist)
Method set()
Set up join keys basing on list of JoinKeySet objects.
Method print()
Prints this JoinKeys.
Examples
x <- teal.data:::JoinKeys$new()
x$set(
list(
join_key("dataset_A", "dataset_B", c("col_1" = "col_a")),
join_key("dataset_A", "dataset_C", c("col_2" = "col_x", "col_3" = "col_y"))
)
)
x$get()
#> $dataset_A
#> $dataset_A$dataset_B
#> col_1
#> "col_a"
#>
#> $dataset_A$dataset_C
#> col_2 col_3
#> "col_x" "col_y"
#>
#>
#> $dataset_B
#> $dataset_B$dataset_A
#> col_a
#> "col_1"
#>
#>
#> $dataset_C
#> $dataset_C$dataset_A
#> col_x col_y
#> "col_2" "col_3"
#>
#>
x$mutate("dataset_A", "dataset_B", c("col1" = "col10"))
x$get("dataset_A", "dataset_B")
#> col1
#> "col10"