How does cut with breaks work in R
<p>I am trying to understand how cut divides and creates intervals; tried <strong>?cut</strong> but can't be able to figure out how <strong>cut</strong> in <strong>r</strong> works.<br>
Here is my problem:  </p>

<pre><code>set.seed(111)
data1 &lt;- seq(1,10, by=1)
data1 
[1]  1  2  3  4  5  6  7  8  9 10
data1cut&lt;- cut(data1, breaks = c(0,1,2,3,5,7,8,10), labels = FALSE)
data1cut
[1] 1 2 3 4 4 5 5 6 7 7
</code></pre>

<p>1. Why did 8,9,10 not included in <strong>data1cut</strong> result?<br>
2. why did <strong>summary(data1)</strong> and <strong>summary(data1cut)</strong> produces different result?     </p>

<pre><code>summary(data1)
Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
1.00    3.25    5.50    5.50    7.75   10.00 

summary(data1cut)
Min. 1st Qu.  Median    Mean 3rd Qu.    Max. 
1.00    3.25    4.50    4.40    5.75    7.00  
</code></pre>

<p>How should i better use <strong>cut</strong> so that i can create say <strong>4 bins</strong> based on the results of <strong>summary(data1)</strong>?</p>

<pre><code>bin1 [1 -3.25]
bin2 (3.25 -5.50]
bin3 (5.50 -7.75]
bin4 (7.75 -10] 
</code></pre>

<p>Thank you.</p>