Learn R Programming

causalDisco (version 1.0.1)

remove_edge: Remove an Edge from Knowledge

Description

Drop a single directed edge specified by from and to. Errors if the edge does not exist.

Usage

remove_edge(kn, from, to)

Value

The updated Knowledge object.

Arguments

kn

A Knowledge object.

from

The source node (unquoted or character).

to

The target node (unquoted or character).

See Also

Other knowledge functions: +.Knowledge(), add_exogenous(), add_tier(), add_to_tier(), add_vars(), as_bnlearn_knowledge(), as_pcalg_constraints(), as_tetrad_knowledge(), convert_tiers_to_forbidden(), deparse_knowledge(), forbid_edge(), get_tiers(), knowledge(), knowledge_to_caugi(), remove_tiers(), remove_vars(), reorder_tiers(), reposition_tier(), require_edge(), seq_tiers(), unfreeze()

Examples

Run this code
# 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)

kn <- remove_edge(kn, child_x1, youth_x3)
print(kn)

kn <- remove_vars(kn, starts_with("child_"))
print(kn)

kn <- remove_tiers(kn, "child")
print(kn)

Run the code above in your browser using DataLab