Displaying 1 result from an estimated 1 matches for "tp3587715p4633630".
Did you mean:
tp3587715p4633628
2011 Jun 10
3
how to convert a vector to an upper matrix
Hi all,
If I have a vector A<-1:6, I would like to convert A to an upper
matrix M=[0 1 2 3 ; 0 0 4 5 ; 0 0 0 6; 0 0 0 0].
That is, if the length of the known vector is n, then the order m of
the matrix I'd like to have should satisfy m(m-1)/2=n
How could I do this in R?
I really don't want to do it using a loop. Is there a function in R to do this ?
Thanks!
Best,
Zhishi