R: Rank of a Matrix

Description Usage Arguments Value See Also Examples

View source: R/R.R

Description

Returns the rank of a matrix X, using the QR decomposition, QR. Included here as a simple function, because rank does something different and it is not obvious what to use for matrix rank.

Usage

1
R(X)

Arguments

X

a matrix

Value

rank of X

See Also

qr

Examples

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
M <- outer(1:3, 3:1)
M
R(M)

M <- matrix(1:9, 3, 3)
M
R(M)
# why rank=2?
echelon(M)

set.seed(1234)
M <- matrix(sample(1:9), 3, 3)
M
R(M)

matlib documentation built on April 4, 2018, 5:03 p.m.