Displaying 1 result from an estimated 1 matches for "maxrun".
2005 Oct 05
2
problem accumulating array within a function over loops
...al loops of a program outside the function.
The problem is that the array seems to re-set at every entry to the
function. Here is an example, so you can see what I mean.
########################################################################
#First, I declare the array and loop control variables
maxrun=3; a=array(NA, c(3,5)); run=0
# Then I define the function "testf"
testf=function(x,y){
print(paste('Run:',run)) #check that the function knows about "run"
a[run,1:3]=runif(3); a[run,4]=x; a[run,5]=y #collect numbers into array "a"
print(paste("Row",...