I'd just sort them first, if you want consecutive numbers for each value. (It would have been nice to specify that in the original question.)
If you need for some reason to put them back in order, you can always cbind(1:nrow(x), x) before sorting, to get an index to sort on after you're done. As always, there are other ways to do it. Sarah On Tue, Mar 6, 2012 at 12:32 PM, syrvn <ment...@gmx.net> wrote: > Hi Sarah, > > thanks a lot for this peace of code. > > Is it possible to give the second sequence of "B" in your second example > (data frame b) > the numbers 6, 7 and 8 instead of 1, 2 and 3 again? In my real data I have > more columns than > only those two and sometimes the are sorted differently so that column name > rather looks like > your second example (data frame b) rather than your first one. > > Regards > -- Sarah Goslee http://www.functionaldiversity.org ______________________________________________ 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.