[R] help generalizing the following non-symmetric "identity"-like matrix

Charlie Brown charliethebrown77 at gmail.com
Thu Sep 26 18:24:28 CEST 2013


Hi,
I need help generalizing the following non-symmetric "identity"-like matrix
In this case:

p = 5
k=3

and I want this:

I.kp <- cbind(diag(3), c(0, 0, 0), c(0, 0, 0))

How can I generalize this so that I don't have to add/subtract c(0, 0,
... , 0) when p and k changes?

Hopefully that makes sense.
Thanks.
Chuck



More information about the R-help mailing list