[Rd] diag() (PR#555)

davidD@qimr.edu.au davidD@qimr.edu.au
Thu, 25 May 2000 03:39:37 +0200 (MET DST)

Full_Name: David Duffy
Version: 1.0.1
OS: Linux
Submission from: (NULL) (

Documentation for diag() states that "If x is a vector (or a
1-d array) then diag(x) returns a diagonal matrix whose diagonal
is x."
> m<-matrix(1:4,ncol=1)
> diag(m)
[1] 1
diag(as.vector(m)) gives the advertised performance.

Fix: Change documentation.

r-devel 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-devel-request@stat.math.ethz.ch