cut.integer: Convert integer vector to Factor

Description Usage Arguments Value Examples

View source: R/cut.integer.R

Description

S3-method for cut applied to integer vectors where all outcome factors are integer intervals.

Usage

1
2
## S3 method for class 'integer'
cut(x, ...)

Arguments

x

integer vector

...

further arguments passed to or from other methods

Value

If cut.default(x, ...) returns only intger intervals, these are formated in a more natural way and returned as an ordered factor. If non integer interval limits occur, the output of cut.default(x, ...) is retured as is.

Examples

1
2
3
cut.default(1:100, seq(0, 100, 20)) # Gives a quite unnatural output
cut(1:100, seq(0, 100, 20)) # Gives nicer and ordered output
cut(1:10, 3) # no integer intervals and therefor same as cut.default

Example output

  [1] (0,20]   (0,20]   (0,20]   (0,20]   (0,20]   (0,20]   (0,20]   (0,20]  
  [9] (0,20]   (0,20]   (0,20]   (0,20]   (0,20]   (0,20]   (0,20]   (0,20]  
 [17] (0,20]   (0,20]   (0,20]   (0,20]   (20,40]  (20,40]  (20,40]  (20,40] 
 [25] (20,40]  (20,40]  (20,40]  (20,40]  (20,40]  (20,40]  (20,40]  (20,40] 
 [33] (20,40]  (20,40]  (20,40]  (20,40]  (20,40]  (20,40]  (20,40]  (20,40] 
 [41] (40,60]  (40,60]  (40,60]  (40,60]  (40,60]  (40,60]  (40,60]  (40,60] 
 [49] (40,60]  (40,60]  (40,60]  (40,60]  (40,60]  (40,60]  (40,60]  (40,60] 
 [57] (40,60]  (40,60]  (40,60]  (40,60]  (60,80]  (60,80]  (60,80]  (60,80] 
 [65] (60,80]  (60,80]  (60,80]  (60,80]  (60,80]  (60,80]  (60,80]  (60,80] 
 [73] (60,80]  (60,80]  (60,80]  (60,80]  (60,80]  (60,80]  (60,80]  (60,80] 
 [81] (80,100] (80,100] (80,100] (80,100] (80,100] (80,100] (80,100] (80,100]
 [89] (80,100] (80,100] (80,100] (80,100] (80,100] (80,100] (80,100] (80,100]
 [97] (80,100] (80,100] (80,100] (80,100]
Levels: (0,20] (20,40] (40,60] (60,80] (80,100]
  [1] 1-20   1-20   1-20   1-20   1-20   1-20   1-20   1-20   1-20   1-20  
 [11] 1-20   1-20   1-20   1-20   1-20   1-20   1-20   1-20   1-20   1-20  
 [21] 21-40  21-40  21-40  21-40  21-40  21-40  21-40  21-40  21-40  21-40 
 [31] 21-40  21-40  21-40  21-40  21-40  21-40  21-40  21-40  21-40  21-40 
 [41] 41-60  41-60  41-60  41-60  41-60  41-60  41-60  41-60  41-60  41-60 
 [51] 41-60  41-60  41-60  41-60  41-60  41-60  41-60  41-60  41-60  41-60 
 [61] 61-80  61-80  61-80  61-80  61-80  61-80  61-80  61-80  61-80  61-80 
 [71] 61-80  61-80  61-80  61-80  61-80  61-80  61-80  61-80  61-80  61-80 
 [81] 81-100 81-100 81-100 81-100 81-100 81-100 81-100 81-100 81-100 81-100
 [91] 81-100 81-100 81-100 81-100 81-100 81-100 81-100 81-100 81-100 81-100
Levels: 1-20 < 21-40 < 41-60 < 61-80 < 81-100
 [1] (0.991,4] (0.991,4] (0.991,4] (0.991,4] (4,7]     (4,7]     (4,7]    
 [8] (7,10]    (7,10]    (7,10]   
Levels: (0.991,4] (4,7] (7,10]

rccmisc documentation built on May 2, 2019, 2:48 p.m.