Hi R users,

My goal is to rank my samples according to how they fall out in a
histogram with 10 bins to produce a ranking for each sample according
to where it falls on the histogram, with a "1" to represent one tail
of the hist, a "10" to represent the other tail, and a "5" for the
median/mean. I have a number of different data sets to do this with
and in all cases I need this ranking between1-10 regardless of the
number of samples in each set.

e.g.,

x=rnorm(50)
h=hist(x,breaks=10)
h$breaks

[1] -2.0 -1.5 -1.0 -0.5  0.0  0.5  1.0  1.5  2.0

So, I want to add a factor to x where if x is less than -2.0, then new
factor="1"; if x is greater than -2.0 but x is less than -1.5, then
new factor="2", etc.

rank doesn't seem to help

Any tips?

Thanks much.

______________________________________________
R-help@r-project.org mailing list
https://stat.ethz.ch/mailman/listinfo/r-help
PLEASE do read the posting guide http://www.R-project.org/posting-guide.html
and provide commented, minimal, self-contained, reproducible code.

Reply via email to