title: Bin values into factors
body: <p>In my data frame, I have a column containing series of location values:</p>
  
  <pre><code>DistData$LOC=c(0,0,0,25,25,35,35,45,45,55,55,55,65,65,65,75,75,75,100,100,100,REF1,REF1,REF2,REf3,REF3,REF3)
  </code></pre>
  
  <p>I'd like to bin these into factors, where values less than 50 are "NEAR", 50 or greater are "FAR" and all REF* are "REF".</p>
  
  <p>I've tried converting to as.numeric() then cut():</p>
  
  <pre><code>Zone = as.numeric(DistData$LOC)
  Zone = cut(Zone, c(0,50,200,NA),labels=c("NEAR","FAR","REF"))
  </code></pre>
  
  <p>And tried a series of ifelse statements:</p>
  
  <pre><code>Zone = ifelse(Zone&lt;50,"NEAR", ifelse(Zone&gt;=50,"FAR", ifelse(is.na(Zone)&lt;-"REF")))
  </code></pre>
  
  <p>also toyed with gsub(), lapply() and replace() without success.</p>
  
  <p>Any assistance would be very much appreciated. </p>