Newbie here. Many apologies in advance for using the incorrect lingo. I'm new to statistics and VERY new to R. I have a "nx2" matrix , I want to sort the values based on the average of 2 columns and put k lowest (or highest) values in bin1, second k high/low values in bin2, and so on (bins would be of the same dimensions). I should also know what the first index (or position) of the pair has been.
car-1 29 30 car-2 22 24 car-3 16 16 car-4 41 41 car-5 43 45 car-6 34 36 for exmample in bins of 2x2 bin1 car-3 16 16 car-2 22 24 bin2 car-1 29 30 car-6 34 35 bin3 car-4 41 41 car-5 43 45 -- View this message in context: http://r.789695.n4.nabble.com/Binning-a-2-column-matrix-by-avarages-of-rows-tp4207606p4207606.html Sent from the R help mailing list archive at Nabble.com. ______________________________________________ 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.