Converts a Knowledge object to a Tetrad edu.cmu.tetrad.data.Knowledge.
This requires rJava. This is used internally, when setting knowledge with
set_knowledge() for methods using the Tetrad engine. set_knowledge() is used
internally, when using the disco() function with knowledge given.
See also
Other knowledge functions:
+.Knowledge(),
add_exogenous(),
add_tier(),
add_to_tier(),
add_vars(),
as_bnlearn_knowledge(),
as_pcalg_constraints(),
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(),
unfreeze()
Examples
# convert to Tetrad Knowledge via rJava
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
)
jk <- try(as_tetrad_knowledge(kn)) # will run only if rJava/JVM available
try(print(jk)) # prints a Java reference if successful
#> [1] "Java-Object{/knowledge\naddtemporal\n\n1 child_x1 child_x2\n2 youth_x3 youth_x4\n3 oldage_x5 oldage_x6\n\nforbiddirect\n\nrequiredirect\nchild_x1 youth_x3}"
