[R] help with loops

Marcio Resende mresendeufv at yahoo.com.br
Wed Oct 14 22:56:55 CEST 2009

Hi guys, my doubt is quite simple, 

I´ll try to explain:

test = matrix(0, nrow = 783, ncol = 12)
for (x in 1:9){
for (y in 1:12){
### In the original script for each y its generated a vector (87x1)
### 87 times 9(x) = 783 (equals the number of rows I want to fill in the
"test" matrix

What I would like to do is to fill the "test" matrix with the "ys" in the
collumns and the 87 elements of each x in the rows.

for example, x = 1
y = 1
test[1:87, 1] = vector generated when y is 1
x = 2
y = 1
test [88:174,1] = another vector generated when y is 2

Could anybody help me? The script is quite long so i couldn´t just paste it
here I think what i wrote above is undestandable.
Thank you very much
View this message in context: http://www.nabble.com/help-with-loops-tp25898891p25898891.html
Sent from the R help mailing list archive at Nabble.com.

More information about the R-help mailing list