matrixStats icon indicating copy to clipboard operation
matrixStats copied to clipboard

WISH: rowSort

Open kasperdanielhansen opened this issue 8 years ago • 2 comments

Return value when index.return = TRUE would be a list of 2 matrices.

kasperdanielhansen avatar Oct 06 '16 19:10 kasperdanielhansen

I second this. I was going to ask for this myself. Maybe something like this:

  • matrixStats::rowOrder returns matrix of indices as per base::order()
  • matrixStats::rowSort returns sorted matrix as per base::sort()
  • matrixStats::rowOrderSort returns a list containing the above matrices.

arrayn avatar Jan 28 '17 17:01 arrayn

Hi @HenrikBengtsson I'm interested in working on this and putting in a PR. The plan would be to:

  • Use colRanks/rowRanks as a style-guide
  • Copy row or column data into new memory
  • Use standard library function qsort to sort data in new memory
  • Make sorting function NA aware, na.last parameter
  • Copy the results of qsort into the output matrix

Do you see any issue with this? Is there anything to look out for before writing a PR?

traversc avatar Dec 12 '22 18:12 traversc