> How is it possible to group rows of a matrix or a data frame by the same > values > of the first column?
If you mean _group_ as in SQL GROUP BY, use aggregate() with a count or summary statistic. If you mean _sort_, just to get similar values close together, use order() For example, to sort by the first column of a matrix mm: oo <- order(mm[,1]) mm[oo,] order() also takes multiple sort fields so can sort by several columns simultaneously (eg sort by first column and within that by third column etc). S Ellison ******************************************************************* This email and any attachments are confidential. Any use...{{dropped:8}} ______________________________________________ R-help@r-project.org mailing list -- To UNSUBSCRIBE and more, see 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.