title: How do I create binned factor variables from a continuous variable, with custom breaks?
body: <p>I have a vector that looks like this: </p>
  
  <pre><code>dataset &lt;- c(4,7,9,1,10,15,18,19,3,16,10,16,12,22,2,23,16,17)
  </code></pre>
  
  <p>I would like to create four dummy categories, in which I bin the continuous dataset by custom breaks . .. for example: 1:4, 5:9, 10:17, 18:23.  </p>
  
  <p>The output dummy categories would have the same length as the original continuous vector (18 in this case), but now each binned dummy variable would just contain a 1 or a 0.   </p>