title: Creating several dichotomous variables by changing the condition in a loop
body: <p>I want to create several variables, 0/1, that meet a condition with a varying cutoff point. Using an interval of 50 to 100, I'd like to create a 0/1 variable for every point in between those two numbers, where 0 is less than and everything else is 1. </p>
  
  <p>For example:</p>
  
  <p><code>data1$V1&lt;-ifelse(data1$Value&lt;50, 0, 1)</code></p>
  
  <p>where <code>data1$Value</code> has the information for the interval and <code>data1$V1</code> is the first binary vector using 50 as a cutoff, but then <code>data1$V2</code> would be 51, and so forth.</p>
  
  <p>Some reproducible code as a starter:</p>
  
  <pre><code>    data1&lt;-data.frame(Value=sample(1:120, 50, replace=TRUE))
      data1$V1&lt;-ifelse(data1$Value&lt;50, 0, 1)
      data1$V2&lt;-ifelse(data1$Value&lt;51, 0, 1)
      data1$V3&lt;-ifelse(data1$Value&lt;52, 0, 1)
  </code></pre>
  
  <p>How can I do this with a loop?</p>