Skip to content
Prev 279578 / 398506 Next

Rank samples by breaks in hist and assign result as factor

On Dec 6, 2011, at 7:25 PM, Frostygoat wrote:

            
> xb <- as.numeric(cut(x, h$breaks))
 > xb
  [1] 9 2 6 9 9 9 6 5 4 7 8 6 6 9 4 8 5 4 9 7 5 9 5 5 4 2 6 7 4 6 4 9  
3 8 5 3 6 1 7
[40] 5 7 9 4 4 4 7 8 5 6 7

 > str(xdf)
'data.frame':	50 obs. of  2 variables:
  $ x    : num  1.577 -1.525 0.254 1.54 1.6 ...
  $ xbrks: num  9 2 6 9 9 9 6 5 4 7 ...
David Winsemius, MD
West Hartford, CT