title: R - get frequency table of n-grams
body: <p>I want to calculate a frequency table of ngrams in R.</p>
  
  <p>Input is a sequence with 10 elements like</p>
  
  <p>ABC A HDA ASD ABC A UZF FJ UZF FJ</p>
  
  <p>Using the R package ngrams I already got the distinct ngrams (e.g. n=2). But now I want to count the occurences of each ngram and here I struggle. I started with grep to search each ngram in the original sequence but it's quite slow with a high number of elements.</p>
  
  <p>Does anybody know a better way to generate a frequency table of ngrams in R?</p>
  
  <p>Thanks!</p>