Description Usage Arguments Details Value See Also Examples
View source: R/count_specified.R
Counts specified n-grams in the input sequence(s).
1 | count_specified(seq, ngrams)
|
seq |
vector or matrix describing sequence(s). |
ngrams |
vector of n-grams. |
count_specified
counts only selected n-grams declared by
user in the ngrams
parameter. Declared n-grams must be written using the
biogram
notation.
A simple_triplet_matrix
where columns represent
n-grams and rows sequences.
Count all possible n-grams: count_ngrams
.
1 2 3 4 5 6 7 | seqs <- matrix(c(1, 2, 2, 1, 2, 1, 2, 1, 1, 2, 3, 4, 1, 2, 2, 4), nrow = 2)
count_specified(seqs, ngrams = c("1.1.1_0.0", "2.2.2_0.0", "1.1.2_0.0"))
seqs <- matrix(sample(1L:5, 200, replace = TRUE), nrow = 20)
count_specified(seqs, ngrams = c("2_4.2_0", "2_1.4_0", "3_1.3_0",
"2_4.2_1", "2_1.4_1", "3_1.3_1",
"2_4.2_2", "2_1.4_2", "3_1.3_2"))
|
Add the following code to your website.
For more information on customizing the embed code, read Embedding Snippets.