Become an expert in R — Interactive courses, Cheat Sheets, certificates and more!
Get Started for Free

rank

Matrix Rank


Description

Provides an estimate of the rank of a matrix M.

Usage

Rank(M)

Arguments

M

Numeric matrix; vectors will be considered as column vectors.

Details

Provides an estimate of the number of linearly independent rows or columns of a matrix M. Compares an approach using QR-decomposition with one counting singular values larger than a certain tolerance (Matlab).

Value

Matrix rank as integer between 0 and min(ncol(M), nrow(M)).

Note

The corresponding function in Matlab is called rank, but that term has a different meaning in R.

References

Trefethen, L. N., and D. Bau III. (1997). Numerical Linear Algebra. SIAM, Philadelphia.

See Also

Examples

Rank(magic(10))   #=> 7
Rank(magic(100))  #=> 3 (!)
Rank(hilb(8))     #=> 8 , but qr(hilb(8))$rank says, rank is 7.
# Warning message:
# In Rank(hilb(8)) : Rank calculation may be problematic.

pracma

Practical Numerical Math Functions

v2.3.3
GPL (>= 3)
Authors
Hans W. Borchers [aut, cre]
Initial release
2021-01-22

We don't support your browser anymore

Please choose more modern alternatives, such as Google Chrome or Mozilla Firefox.