title: R - Create cut-like intervals with non-empty intersection
body: <p>I have a dataframe <code>df</code> with a column named <code>x1</code> with values between -5 and +5. I am trying to assign for each row of <code>df</code> an interval regarding the values of <code>x1</code>. The function <code>cut</code>allow me do to so :</p>
  
  <pre><code>cut(df$x1,c(-5,-4,-3,-2,-1,0,1,2,3,4,5))
  </code></pre>
  
  <p>and I can then split <code>df</code> into 10 <code>data.frames</code> using <code>by</code>. Unfortunately what I would like is to assign intervals like -5 to -3.95, -4.05 to -2.95, -3.05 to -1.95 and so on, meaning that :</p>
  
  <ul>
  <li>4.06 will be in the interval 3.95-5.05</li>
  <li>4.05 will be in the interval 3.95-5.05 and 2.95-4.05</li>
  <li>4.04 will be in the interval 3.95-5.05 and 2.95-4.05</li>
  <li>3.94 will be in the interval 2.95-4.05</li>
  </ul>
  
  <p>which means that after using <code>by</code>I will have 10 dataframes with a few elements in 2 of those dataframes. </p>
  
  <p>The next part of my question would concern the values near 0 : the intervals should not contain negative and positive values, so the intervals would be like </p>
  
  <ul>
  <li>-5 to -3.95</li>
  <li>-4.05 to -2.95</li>
  <li>...</li>
  <li>-2.05 to -0.95</li>
  <li>-1.05 to 0 AND NOT -1.05 to 0.05</li>
  <li>0 to 1.05 AND NOT -0.05 to 1.05</li>
  <li>0.95 to 2.05</li>
  <li>...</li>
  </ul>
  
  <p>Is there a way to achieve that in R ?</p>
  
  <p><strong>EDIT : df</strong></p>
  
  <p><code>df</code> looks like this :</p>
  
  <pre><code>other_var  ...   x1  ... another_var ...
      100    ... 4     ...   18     ...
      12.3   ... 3.84  ...   -6.2   ...
      1.4    ... 4.78  ...    4.78  ...
      -2     ... -2.51 ...    7.1   ...
      -3.2   ... 0.57  ...   -1     ...
  
  
  dput(df1)
  
  structure(list(x0 = c(0.702166747375488, 0.205532096598193,     0.0704982518296982, 
  -0.159150628995597, -0.162625494967927, -0.331660025490033, -0.099135847436449, 
  -0.137985446193678, -0.179304942878067, 0.0554309512268647), 
  x1 = c(-0.561621170364712, -0.762747775318984, 1.63791710226613, 
  -0.861210697757564, -1.05393723031543, 0.809872536189693, 
  2.85973319518198, 0.211750306033687, 1.18360826959114, -0.358159130198865
  ), x2 = c(-0.304711385106637, 0.365667729645747, -0.406328268107825, 
  -0.315315872233279, -0.477546612710489, 0.251158976293131, 
  -1.1263800774781, 0.229002212764429, -0.00413111289214729, 
  -0.252467704090853)), .Names = c("x0", "x1", "x2"), row.names = c(NA, 
  10L), class = "data.frame")
  </code></pre>