R-beta: qr(A)$rank
Bertram Zinner
zinnebe at mail.auburn.edu
Tue Feb 24 22:07:46 CET 1998
I would like to find the rank of a matrix using R. Looking through a list
of commands it seems that the command qr should do the job. Checking a
simple example gave me the wrong answer. Here is the example:
> A <- c(1,2,3,4,5,6)
> A <- matrix(A, nrow=2, ncol=3)
> A
[,1] [,2] [,3]
[1,] 1 3 5
[2,] 2 4 6
> qr(A)$rank
[1] 3
The correct answer is two.
I should add that I am using the mac version of R. Any suggestions? ---
Bertram
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
r-help mailing list -- Read http://www.ci.tuwien.ac.at/~hornik/R/R-FAQ.html
Send "info", "help", or "[un]subscribe"
(in the "body", not the subject !) To: r-help-request at stat.math.ethz.ch
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
More information about the R-help
mailing list