[R] assignment of matrix

From: <jonathenwu_at_hotmail.com>
Date: Mon 25 Jul 2005 - 20:15:58 EST


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



R-help@stat.math.ethz.ch mailing list
https://stat.ethz.ch/mailman/listinfo/r-help PLEASE do read the posting guide! http://www.R-project.org/posting-guide.html Received on Mon Jul 25 20:19:18 2005

This archive was generated by hypermail 2.1.8 : Fri 03 Mar 2006 - 03:34:01 EST