title: Is there an R function equivalent to range in Python?
body: <p>I am looking to split a string into ngrams of 3 characters - e.g HelloWorld would become &quot;Hel&quot;, &quot;ell&quot;, &quot;llo&quot;, &quot;loW&quot; etc
  How would I achieve this using R?</p>
  <p>In Python it would take a loop using the range function - e.g. <code>[myString[i:] for i in range(3)]</code></p>
  <p>Is there a neat way to loop through the letters of a string using <code>stringr</code> (or another suitable function/package) to tokenize the word into a vector?</p>
  <p>e.g.</p>
  <pre><code>dfWords &lt;- c(&quot;HelloWorld&quot;, &quot;GoodbyeMoon&quot;, &quot;HolaSun&quot;) %&gt;% 
                data.frame()
  names(dfWords)[1] = &quot;Text&quot;
  </code></pre>
  <p>I would like to generate a new column which would contain a vector of the tokenized Text variable (preferably using <code>dplyr</code>). This can then be split later into new columns.</p>