| deparse_knowledge | R Documentation |
Given a Knowledge object, return a single string containing
the R code (using knowledge(), tier(), %-->%, and %!-->%.
that would rebuild that same object.
deparse_knowledge(kn, df_name = NULL)
kn |
A |
df_name |
Optional name of the data frame you used
(used as the first argument to |
A single string (with newlines) of R code.
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(),
forbid_edge(),
get_tiers(),
knowledge(),
knowledge_to_caugi(),
remove_edge(),
remove_tiers(),
remove_vars(),
reorder_tiers(),
reposition_tier(),
require_edge(),
seq_tiers(),
unfreeze()
# turn a Knowledge object back into DSL code
data(tpc_example)
kn <- knowledge(
tpc_example,
tier(
child ~ starts_with("child"),
youth ~ starts_with("youth"),
old ~ starts_with("old")
),
child_x1 %-->% youth_x3,
oldage_x6 %!-->% child_x1
)
code <- deparse_knowledge(kn, df_name = "tpc_example")
cat(code)
# Explicitly add all forbidden edges implied by tiers
kn <- convert_tiers_to_forbidden(kn)
code <- deparse_knowledge(kn, df_name = "tpc_example")
cat(code)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.