[R] manipulating elements of a vector

Vumani Dlamini dvumani at hotmail.com
Thu May 27 12:23:48 CEST 2004


Dear R users;

I would like to convert a series of vectors to matrices in the following 
way;
(2,1,1) to a matrix
1 0 0
1 0 0
0 1 0
0 0 1

The idea is that the column sum of the matrix should be equal to the 
elements of the vector.

Thanks.

Vumani




More information about the R-help mailing list