Skip to content
Back to formatted view

Raw Message

Message-ID: <37072274.50802A41@econ.unito.it>
Date: 1999-04-04T08:27:32Z
From: E. D. Isaia
Subject: Creating Identity Matrices

Dear Alan, here's how to define a simple nxn Identity matrix:

n<-c(5)
 I <- matrix(0,nrow=n,ncol=n)
I[row(I)==col(I)] <- 1

E.D.Isaia

"Alan T. Arnholt" wrote:

> Dear R users,
>
> What is the easiest way to construct an identity matrix?
> Thanks.
>
> Alan
> ___________________________________
> Alan T. Arnholt
> Associate Professor
> Dept. of Mathematical Sciences
> Appalachian State University
> Boone, NC  28608
> http://www.mathsci.appstate.edu/~arnholt/
> Office phone: (828) 262 - 2863
> Office fax  : (828) 265 - 8617
>
> -.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
> 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
> _._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._
-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-.-
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
_._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._._