View source: R/knowledge-verbs.R
| seq_tiers | R Documentation |
Quickly create a series of two‐sided formulas for use with tier(),
where each formula maps a numeric tier index to a tidyselect specification
that contains the placeholder i. The placeholder i is replaced
by each element of tiers in turn, allowing you to write a single
template rather than many nearly identical formulas.
seq_tiers(tiers, vars)
tiers |
An integer vector of tier indices (each >= 1). These will appear as the left‐hand sides of the generated formulas. |
vars |
A tidyselect specification (unevaluated) that must contain the special
placeholder |
A list of two‐sided formulas, each of class "tier_bundle".
You can pass this list directly to tier() (which will expand it
automatically).
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(),
deparse_knowledge(),
forbid_edge(),
get_tiers(),
knowledge(),
knowledge_to_caugi(),
remove_edge(),
remove_tiers(),
remove_vars(),
reorder_tiers(),
reposition_tier(),
require_edge(),
unfreeze()
# generate a bundle of tier formulas using a pattern with {i}
# here we create: 1 ~ matches("^child_x1$"), 2 ~ matches("^child_x2$")
data(tpc_example)
kn <- knowledge(
tpc_example,
tier(seq_tiers(1:2, matches("^child_x{i}$")))
)
print(kn)
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.