[R] matrix problem

Xia.Li odditylee at gmail.com
Tue Aug 10 20:27:06 CEST 2010


Let me give you a not that efficient one...

assume you have read the matrix (named as x) into R:

n=dim(x)[1]
y=matrix(0,n,n)
for (i in 1:n) y[x[i,1],x[i,2]]=x[i,3]


-- 
View this message in context: http://r.789695.n4.nabble.com/matrix-problem-tp2320193p2320219.html
Sent from the R help mailing list archive at Nabble.com.



More information about the R-help mailing list