# NOT RUN {
library(magrittr)
set_1 <- data.frame(key = 1:100, value = sample(letters, 100, TRUE), stringsAsFactors = TRUE)
set_2 <- data.frame(key = 1:100, value = sample(LETTERS, 100, TRUE), stringsAsFactors = TRUE)
# Common variable: `key`
as_entityset(set_1, index = "key", entity_id = "set_1", id = "demo") %>%
add_entity(entity_id = "set_2", df = set_2, index = "key") %>%
add_relationship(
parent_set = "set_1",
child_set = "set_2",
parent_idx = "key",
child_idx = "key"
)
# }
Run the code above in your browser using DataLab