I currently have a cycle - well, actually, a cycle in a cycle, in a simulation that slows down with a lot of people. I quoted most of this and did it much faster. But there is a part where I assign several list items as one and the same, simplifying a large loop only for the task I want to achieve:
new.matrices[[length(new.matrices)+1]]<-old.matrix
With each iteration of the loop, the line above is called, and the same matrix object is assigned to the next new list item.
I am trying to quote this if possible, or make it faster than a loop or apply an expression.
So far I have tried things line by line:
indices <- seq(from = length(new.matrices) + 1, to = length(new.matrices) + reps)
new.matrices[indices] <- old.matrix
However, this leads to the message:
Warning message:
In new.effectors[effectorlength] <- matrix :
number of items to replace is not a multiple of replacement length
He also tries to assign one value to old.matrixone element new.matriceslike this:
[[1]]
[1] 8687
[[2]]
[1] 1
[[3]]
[1] 5486
[[4]]
[1] 0
= , old.matrix
, ? , , , , , , .