Skip to contents

Drops the given variables from kn$vars, and automatically removes any edges that mention them.

Usage

remove_vars(kn, ...)

Arguments

kn

A Knowledge object.

...

Unquoted variable names or tidy‐select helpers.

Value

An updated Knowledge object.

Examples

# remove variables and their incident edges
data(tpc_example)

kn <- knowledge(
  head(tpc_example),
  tier(
    child ~ starts_with("child"),
    youth ~ starts_with("youth"),
    oldage ~ starts_with("old")
  ),
  child_x1 %-->% youth_x3
)
print(kn)
#> <Knowledge: 3 tiers | 6 vars | 1 required>
#>   tier(child): child_x1, child_x2
#>   tier(youth): youth_x3, youth_x4
#>   tier(oldage): oldage_x5, oldage_x6
#>   required:
#>     child_x1-->youth_x3

kn <- remove_edge(kn, child_x1, youth_x3)
print(kn)
#> <Knowledge: 3 tiers | 6 vars>
#>   tier(child): child_x1, child_x2
#>   tier(youth): youth_x3, youth_x4
#>   tier(oldage): oldage_x5, oldage_x6

kn <- remove_vars(kn, starts_with("child_"))
print(kn)
#> <Knowledge: 3 tiers | 4 vars>
#>   tier(youth): youth_x3, youth_x4
#>   tier(oldage): oldage_x5, oldage_x6

kn <- remove_tiers(kn, "child")
print(kn)
#> <Knowledge: 2 tiers | 4 vars>
#>   tier(youth): youth_x3, youth_x4
#>   tier(oldage): oldage_x5, oldage_x6