counts | R Documentation |
This function reports the number of occurrences of the sequence represented
by node
in the original time series used to build the associated context
tree (not including a possible final occurrence not followed by any value at
the end of the original time series). In addition if frequency=="detailed"
,
the function reports the frequencies of each of the possible value of the
time series when they appear just after the sequence.
counts(node, frequency = c("detailed", "total"), local = FALSE)
## S3 method for class 'ctx_node'
counts(node, frequency = c("detailed", "total"), local = FALSE)
## S3 method for class 'ctx_node_cpp'
counts(node, frequency = c("detailed", "total"), local = FALSE)
node |
a |
frequency |
specifies the counts to be included in the result. |
local |
specifies how the counts are computed. When |
either an integer when frequency="total"
which gives the total
number of occurrences of the sequence represented by node
or a
data.frame
with a total
column with the same value and a column for
each of the possible value of the original time series, reporting counts in
each column (see the description above).
contexts()
and contexts.ctx_tree()
dts <- sample(as.factor(c("A", "B", "C")), 100, replace = TRUE)
dts_tree <- ctx_tree(dts, max_depth = 3, min_size = 5)
subseq <- find_sequence(dts_tree, factor(c("A", "A"), levels = c("A", "B", "C")))
if (!is.null(subseq)) {
counts(subseq)
}
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.