This allows you to add new variables to the Knowledge object,
even though it was frozen earlier by adding a data frame to the knowledge
constructor knowledge().
See also
Other knowledge helpers:
+.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(),
reposition_tier(),
require_edge(),
seq_tiers(),
set_knowledge()
Examples
# unfreeze allows adding variables beyond the original data frame columns
data(tpc_example)
kn <- knowledge(tpc_example)
# this would error while frozen
try(add_vars(kn, "new_var"))
#> Error : Unknown variable(s): [new_var]
#> They are not present in the data frame provided to this Knowledge object.
# unfreeze and add the new variable successfully
kn <- unfreeze(kn)
kn <- add_vars(kn, "new_var")
print(kn)
#> <Knowledge: 7 vars>
#> vars: child_x1, child_x2, oldage_x5, oldage_x6, youth_x3, youth_x4, new_var
