Reorder Tiers in Knowledge
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(),
reposition_tier(),
require_edge(),
seq_tiers(),
unfreeze()
Examples
# 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)
#>
#> ── Knowledge object ────────────────────────────────────────────────────────────
#>
#> ── Tiers ──
#>
#> tier
#> <chr>
#> 1 youth
#> 2 child
#> 3 oldage
#> ── Variables ──
#>
#> var tier
#> <chr> <chr>
#> 1 child_x1 child
#> 2 child_x2 child
#> 3 youth_x3 youth
#> 4 youth_x4 youth
#> 5 oldage_x5 oldage
#> 6 oldage_x6 oldage
