Learn R Programming

biogram (version 1.0)

create_ngrams: Get All Possible N-Grams

Description

Creates vector of all posible n_grams (for given n).

Usage

create_ngrams(n, u, possible_grams = NULL)

Arguments

n
integer size of n-gram.
u
unigrams (integer, numeric or character vector).
possible_grams
number of possible n-grams. If not NULL n-grams do not contain information about position

Value

  • a character vector. Elements of n-gram are separated by dot.

Details

See Details section of count_ngrams for more information about n-grams naming convention.

Examples

Run this code
#bigrams for standard aminoacids
create_ngrams(2, 1L:20)
#bigrams for standard aminoacids with positions, 10 nucleotide long sequence
create_ngrams(2, 1L:20, 9)

Run the code above in your browser using DataLab