Learn R Programming

biogram (version 1.0)

get_ngrams_ind: Get Indices of N-Grams

Description

Computes list of n-gram elements positions in sequence.

Usage

get_ngrams_ind(len_seq, n, d)

Arguments

len_seq
integer value describing sequence's length.
n
integer size of n-gram.
d
integer vector of distances between elements of n-gram (0 means consecutive elements). See Details.

Value

  • A list with number of elements equal to n. Every element is a vector containing locations of given n-gram letter. For example, first element of list contain indices of first letter of all n-grams. The attribute d of output contains distances between letter used to compute locations (see Details).

Details

A format of d vector is discussed in Details of count_ngrams.

Examples

Run this code
#positions trigrams in sequence of length 10
get_ngrams_ind(10, 9, 0)

Run the code above in your browser using DataLab