Skip to contents

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.

Usage

as_tetrad_knowledge(kn)

Arguments

kn

A Knowledge object.

Value

A Java edu.cmu.tetrad.data.Knowledge object.

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}"