View source: R/ctx_node_navigation.R
parent | R Documentation |
This function returns the parent node of the node represented by the
node
parameter. The result is NULL
if node
is the root node of
its context tree (representing the empty sequence).
parent(node)
## S3 method for class 'ctx_node'
parent(node)
## S3 method for class 'ctx_node_cpp'
parent(node)
node |
a |
Each node of a context tree represents a sequence. When find_sequence()
is
called with success, the returned object represents the corresponding node in
the context tree. Unless the original sequence is empty, this node has a
parent node which is returned as a ctx_node
object by the present function.
Another interpretation is that the function returns the node
object
associated to the sequence obtained by removing the oldest value from the
original sequence.
a ctx_node
object if node
does correspond to the empty
sequence or NULL
when this is not the case
dts <- c(0, 1, 1, 1, 0, 0, 1, 0, 1, 0)
dts_ctree <- ctx_tree(dts, min_size = 1, max_depth = 3)
ctx_00 <- find_sequence(dts_ctree, c(0, 0))
## the parent sequence/node corresponds to the 0 context
parent(ctx_00)
identical(parent(ctx_00), find_sequence(dts_ctree, c(0)))
## C++ backend
dts <- c(0, 1, 1, 1, 0, 0, 1, 0, 1, 0)
dts_ctree <- ctx_tree(dts, min_size = 1, max_depth = 3, backend = "C++")
ctx_00 <- find_sequence(dts_ctree, c(0, 0))
## the parent sequence/node corresponds to the 0 context
parent(ctx_00)
identical(parent(ctx_00), find_sequence(dts_ctree, c(0)))
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.