powered by
Extracts vector of n-grams present in sequence(s).
seq2ngrams(seq, n, u, d = 0, pos = FALSE)
a vector or matrix describing sequence(s).
integer size of n-gram.
integer
integer, numeric or character vector of all possible unigrams.
numeric
character
integer vector of distances between elements of n-gram (0 means consecutive elements). See Details.
logical, if TRUE position-specific n_grams are counted.
logical
TRUE
A character matrix of n-grams, where every row corresponds to a different sequence.
A format of d vector is discussed in Details of count_ngrams.
d
count_ngrams
# NOT RUN { # trigrams from multiple sequences seqs <- matrix(sample(1L:4, 600, replace = TRUE), ncol = 50) seq2ngrams(seqs, 3, 1L:4) # }
Run the code above in your browser using DataLab