2012-06-04 143 views

回答

7

你可以試試功能qr( 「QR」,因爲它進行了QR decomposition):在

#define a matrix for this example 
M <- matrix(data = rnorm(12), ncol = 3) 

#run the function qr() 
qr(M)$rank 

#Alternative: load the Matrix package... 
require(Matrix) 

#...and run the function rankMatrix() 
rankMatrix(M)[1]