[R] Finding a basis in a set of vectors

Zhou Fang zhou.zfang at gmail.com
Fri Feb 6 15:10:27 CET 2009


Okay, I have a n x p matrix X, which I know is not full rank. In
particular, there may be linear dependencies amongst the columns (but
not that many). What is a fast way of finding a linearly independent
subset of the columns of X that will span the column space of X, in R?
If it helps, I have the QR decomposition of the original X 'for free'.

I know that it's possible to do this directly by looping over the
columns and adding them, but at the very least, a solution without
horrible slow loops would be nice.

Any ideas welcome.

Zhou Fang

More information about the R-help mailing list