Skip to contents

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().

Usage

unfreeze(kn)

Arguments

kn

A Knowledge object.

Value

The same Knowledge object with the frozen attribute set to FALSE.

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