I want to create 200 matrices of dimensions 200 X 129. I have a bit of code that needs to run over the 200 matrices, but each new matrix references the previous one.
for(i in 1:200)
{
nam <- paste("step", i, sep = "")
mat<- matrix(ncol=129, nrow=200)
assign(nam, mat)
stepg<- matrix(ncol=129, nrow=200)
stepg<- step[i][200,129]
index<-sample(1:nrow(stepg), 2)
}
When I run this code, I get an error "Error in step[i][20, 30] : incorrect number of dimensions". I want to know how to reference the ith matrix.
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…