[R] matrix problem-replacing pieces of a matrix

2011-06-21 Thread Costis Ghionnis
#Hallo again.. Thank you for your answers. To sum up: #The problem was that we have the matrix m m-matrix(numeric(length=5*4),nrow=5,ncol=4) m # [,1] [,2] [,3] [,4] # [1,]0000 # [2,]0000 # [3,]0000 # [4,]0000 # [5,]00

[R] matrix problem

2011-06-20 Thread Costis Ghionnis
Hallo everyone! I have a problem about creating a matrix... Suppose we have a vector y-c(1,1,1,3,2) and a zero matrix, m ,with nrows=length(y) and ncol=4. The matrix would look like this: 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0 0