Skip to content
Prev 276639 / 398506 Next

Intervals in function cut

In stepping through 'cut.default' that is called, I get the following interval:

 -0.008  0.994  1.996  2.998  4.000  5.002  6.004  7.006  8.008

In printing out to three significant digits, you will have "(0.994,
2]"  or "(2,3]" as you see in the factors.

If instead you used:

cut(x, b = 8, dig.lab = 7)

you will get:

cut(x, b= 8, dig.lab=7)
 [1] (-0.008,0.994] (-0.008,0.994] (-0.008,0.994] (-0.008,0.994]
(-0.008,0.994] (-0.008,0.994]
 [7] (-0.008,0.994] (-0.008,0.994] (-0.008,0.994] (0.994,1.996]
(0.994,1.996]  (0.994,1.996]
[13] (0.994,1.996]  (1.996,2.998]  (1.996,2.998]  (1.996,2.998]
(1.996,2.998]  (1.996,2.998]
[19] (1.996,2.998]  (2.998,4]      (2.998,4]      (2.998,4]
(2.998,4]      (2.998,4]
[25] (4,5.002]      (4,5.002]      (4,5.002]      (4,5.002]
(4,5.002]      (4,5.002]
[31] (4,5.002]      (4,5.002]      (4,5.002]      (4,5.002]
(4,5.002]      (4,5.002]
[37] (4,5.002]      (5.002,6.004]  (5.002,6.004]  (5.002,6.004]
(5.002,6.004]  (5.002,6.004]
[43] (6.004,7.006]  (6.004,7.006]  (6.004,7.006]  (7.006,8.008]
(7.006,8.008]  (7.006,8.008]
[49] (7.006,8.008]  (7.006,8.008]
8 Levels: (-0.008,0.994] (0.994,1.996] (1.996,2.998] (2.998,4]
(4,5.002] ... (7.006,8.008]

aren't floating point numbers fun; read FAQ 7.31
On Mon, Nov 7, 2011 at 7:48 PM, JulioSergio <juliosergio at gmail.com> wrote: