[R] assignment of matrix

=?gb2312?B?zuIg6rs=?= jonathenwu at hotmail.com
Mon Jul 25 12:15:58 CEST 2005


Hi,
I have created a matrix and initially all elements in the matrix was 
assigned to NA.Then I want to assign values to some elements of this 
matrix. Can I use formation like matrix[i][j] <- 4?if not, how can i do 
this? now I have three vectors
 y1  y2   y3
 3   4     3.1
 5   2     4.2
if I want to assign y3's value to matrix, where the value's row and column 
should correspond the y1's and y2's value, such like
matrix[y1[1]][y2[1]] <- y3[1]
how can this be realized?
thanks
Hao Wu




More information about the R-help mailing list