For reasons unknown, I can’t find a function to transform a matrix into row echelon form in R. There’s a function on Rosetta Code for reduced row echelon form in R. So I wrote this on Sunday. And if you look at this and the Rosetta Code solution, they work in mostly the same way. This will be released as part of a larger package later, with documentation and unit tests. But it’s useful enough to stand on its own here.