add_relationship: Add a relationship to an entityset

Description Usage Arguments Value Examples

View source: R/add_relationship.R

Description

Add a relationship to an entityset.

Usage

1
add_relationship(entityset, parent_set, child_set, parent_idx, child_idx)

Arguments

entityset

The entityset to modify.

parent_set

The name of the parent set.

child_set

The name of the child set.

parent_idx

The index variable of the 'parent_set'.

child_idx

The index variable of the 'child_set'.

Value

A modified entityset.

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
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"
  )

featuretoolsR documentation built on April 25, 2020, 5:05 p.m.