Mutate JoinKeys
with a new values
mutate_join_keys.Rd
Usage
mutate_join_keys(x, dataset_1, dataset_2, val)
# S3 method for JoinKeys
mutate_join_keys(x, dataset_1, dataset_2, val)
# S3 method for TealData
mutate_join_keys(x, dataset_1, dataset_2, val)
Arguments
- x
(
JoinKeys
) object to be modified- dataset_1
(
character
) one dataset name- dataset_2
(
character
) other dataset name- val
(named
character
) column names used to join
Examples
# JoinKeys ----
x <- join_keys(
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_B")
#> col_1
#> "col_a"
mutate_join_keys(x, "dataset_A", "dataset_B", c("col_1" = "col_10"))
x$get("dataset_A", "dataset_B")
#> col_1
#> "col_10"
# TealData ----
ADSL <- teal.data::example_cdisc_data("ADSL")
ADRS <- teal.data::example_cdisc_data("ADRS")
x <- cdisc_data(
cdisc_dataset("ADSL", ADSL),
cdisc_dataset("ADRS", ADRS)
)
x$get_join_keys()$get("ADSL", "ADRS")
#> STUDYID USUBJID
#> "STUDYID" "USUBJID"
mutate_join_keys(x, "ADSL", "ADRS", c("COLUMN1" = "COLUMN2"))
x$get_join_keys()$get("ADSL", "ADRS")
#> COLUMN1
#> "COLUMN2"