search for: triangualr

Displaying 1 result from an estimated 1 matches for "triangualr".

2012 Sep 23
3
Confused by code?
x<-matrix(c(1,0,0,0,1,0,0,0,1),nrow=3) > y<-matrix(c(0,0,0,1,0,0,1,1,0),nrow=3) > z<-matrix(c(0,1,0,0,1,0,1,0,0),nrow=3) > x[z]<-y[z] The resultant matrix x is all zeros except for the last two diagonal cells which are 1's. While y is lower triangualr 0's with the remaining cells all ones. I really don't understand how this deceptively simple looking piece of code is giving that result can someone explain please. I'm obviously missing something pretty basic so please keep your answer suitably basic. -- View this message in contex...