We are trying to use the for
command to run a function y (say y=5+3x+4z
) by varying the values of z (say that z is a combination of 5 z=c(1,2,3,4,5)
) and that x is a normal size distribution 1000. After printing the values we used by indexing, how could we transform these results into an array of 1000 rows and 5 columns (1000 observations for each z value)?
After using the for
command:
z=c(1,2,3,4,5)
for(i in c(1,2,3,4,5)) print(y<-5+3x+4z[i]))
We tried to define an array of y that does not work because it printed the first column on the remaining 4.