title: Cut() error - 'breaks' are not unique
body: <p>I have following dataframe: </p>
  
  <pre><code> a         
      ID   a.1    b.1     a.2   b.2
  1    1  40.00   100.00  NA    88.89
  2    2  100.00  100.00  100   100.00
  3    3  50.00   100.00  75    100.00
  4    4  66.67   59.38   NA    59.38
  5    5  37.50   100.00  NA    100.00
  6    6  100.00  100.00  100   100.00
  </code></pre>
  
  <p>When I apply the following code to this dataframe: </p>
  
  <pre><code> temp &lt;- do.call(rbind,strsplit(names(df)[-1],".",fixed=TRUE))
   dup.temp &lt;- temp[duplicated(temp[,1]),]
  
   res &lt;- lapply(dup.temp[,1],function(i) {
   breaks &lt;- c(-Inf,quantile(a[,paste(i,1,sep=".")], na.rm=T),Inf)
   cut(a[,paste(i,2,sep=".")],breaks)
   })
  </code></pre>
  
  <p>the cut () function gives an error: </p>
  
  <pre><code> Error in cut.default(a[, paste(i, 2, sep = ".")], breaks) : 
   'breaks' are not unique
  </code></pre>
  
  <p>However, the same code works perfectly well on similar dataframe:</p>
  
  <pre><code> varnames&lt;-c("ID", "a.1", "b.1", "c.1", "a.2", "b.2", "c.2")
  
   a &lt;-matrix (c(1,2,3,4, 5, 6, 7), 2,7)
  
   colnames (a)&lt;-varnames
  
   df&lt;-as.data.frame (a)
  
  
      ID  a.1  b.1  c.1  a.2  b.2  c.2
    1  1    3    5    7    2    4    6
    2  2    4    6    1    3    5    7
  
   res &lt;- lapply(dup.temp[,1],function(i) {
   breaks &lt;- c(-Inf,quantile(a[,paste(i,1,sep=".")], na.rm=T),Inf)
   cut(a[,paste(i,2,sep=".")],breaks)
   })
  
   res
  [[1]]
  [1] (-Inf,3] (-Inf,3]
  Levels: (-Inf,3] (3,3.25] (3.25,3.5] (3.5,3.75] (3.75,4] (4, Inf]
  
  [[2]]
  [1] (-Inf,5] (-Inf,5]
  Levels: (-Inf,5] (5,5.25] (5.25,5.5] (5.5,5.75] (5.75,6] (6, Inf]
  
  [[3]]
  [1] (5.5,7] (5.5,7]
  Levels: (-Inf,1] (1,2.5] (2.5,4] (4,5.5] (5.5,7] (7, Inf]
  </code></pre>
  
  <p>What it the reason for this error? 
  How can it be fixed? 
  Thank you. </p>