This function reverses the order in which the sequence represented by the
ctx_node
parameter will be reported in other functions, mainly
as_sequence()
.
Usage
# S3 method for ctx_node
rev(x)
Arguments
- x
a
ctx_node
object as returned byfind_sequence()
Examples
dts <- c("A", "B", "C", "A", "A", "B", "B", "C", "C", "A")
dts_tree <- ctx_tree(dts, max_depth = 3)
res <- find_sequence(dts_tree, c("A", "B"))
print(res)
#> Context [T]: A, B
#> followed by A (0), B (1), C (1)
r_res <- rev(res)
print(r_res)
#> Context [R]: B, A
#> followed by A (0), B (1), C (1)
as_sequence(r_res)
#> [1] "B" "A"