Skip to contents

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 by find_sequence()

Value

a ctx_node using the opposite ordering convention as the parameter of the function

See also

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"