R-beta: qr(A)$rank

Thomas Lumley thomas at biostat.washington.edu
Tue Feb 24 22:22:56 CET 1998


On Tue, 24 Feb 1998, Bertram Zinner wrote:

> 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 think this is due to the mac version being so out of date.  I don't have
access to it, but qr(A)$rank does work on 0.50a2 and 0.61.1 (at least
ignoring the question of whether the rank is well-defined numerically).

What does the rest of qr(A) look like? This might help in deciding what to
do, especially as a large chunk of the Mac expertise on R is temporarily
unavailable due to power failures in New Zealnd. 

	-thomas


Thomas Lumley
------------------------------------------------------+------
Biostatistics		: "Never attribute to malice what  :
Uni of Washington	:  can be adequately explained by  :
Box 357232		:  incompetence" - Hanlon's Razor  :
Seattle WA 98195-7232	:				   :
------------------------------------------------------------

-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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