Randomly sample terms/items

random_terms(dag, n)

random_items(dag, n)

Arguments

dag

An ontology_DAG object.

n

Number of terms or items.

Value

A character vector of terms or items.

Examples

parents  = c("a", "a", "b", "b", "c", "d")
children = c("b", "c", "c", "d", "e", "f")
annotation = list(
    "a" = c("t1", "t2", "t3"),
    "b" = c("t3", "t4"),
    "c" = "t5",
    "d" = "t7",
    "e" = c("t4", "t5", "t6", "t7"),
    "f" = "t8"
)
dag = create_ontology_DAG(parents, children, annotation = annotation)
random_terms(dag, 3)
#> [1] "a" "e" "c"
random_items(dag, 3)
#> [1] "t2" "t5" "t4"