Stratify a variable in R : <p>An example</p>

<pre><code>mtcars$qsec
 [1] 16.46 17.02 18.61 19.44 17.02 20.22 15.84 20.00 22.90 18.30 18.90 17.40
[13] 17.60 18.00 17.98 17.82 17.42 19.47 18.52 19.90 20.01 16.87 17.30 15.41
[25] 17.05 18.90 16.70 16.90 14.50 15.50 14.60 18.60
</code></pre>

<p>I want to stratify or group that variable. The point is I want to do it in the same steps (e.g. <code>5</code>).</p>

<p>Currently I would do it like that</p>

<pre><code>mtcars$qsec_group[mtcars$qsec &lt; 10] &lt;- '10 or less'
mtcars$qsec_group[mtcars$qsec &gt;= 10 &amp; mtcars$qsec &lt; 15] &lt;- '10-15'
mtcars$qsec_group[mtcars$qsec &gt;= 15 &amp; mtcars$qsec &lt; 20] &lt;- '15-20'
</code></pre>

<p>It is quite unflexible. Is there an <strong>R-way</strong> to say <em>Stratify that variable in steps of 5.</em>?</p>
