Learn R Programming

causalDisco (version 1.0.1)

reposition_tier: Move a Tier Relative to Another in Knowledge

Description

Move a Tier Relative to Another in Knowledge

Usage

reposition_tier(kn, tier, before = NULL, after = NULL, by_index = FALSE)

Value

The updated Knowledge object.

Arguments

kn

A Knowledge object.

tier

The tier to move (label or index, honouring by_index).

before

Exactly one of these must be supplied and must identify another existing tier.

after

Exactly one of these must be supplied and must identify another existing tier.

by_index

If TRUE, treat order as the positions instead of labels. Defaults to FALSE.

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_edge(), remove_tiers(), remove_vars(), reorder_tiers(), require_edge(), seq_tiers(), unfreeze()

Examples

Run this code
# Move one tier relative to another
data(tpc_example)

kn <- knowledge(
  head(tpc_example),
  tier(
    child ~ starts_with("child"),
    youth ~ starts_with("youth"),
    oldage ~ starts_with("old")
  )
)

kn <- reorder_tiers(kn, c("youth", "child", "oldage"))
print(kn)

Run the code above in your browser using DataLab