I have a data matrix containing around 180 variables and more than 470
observations for each and no missing values. 
 
Within a for-loop, the first step of calculations is to standardize each
column, such that the mean of each column is zero and the sd is one. The
for-loop starts with a subset of the initial matrix and includes all columns
but only a third of the rows. The loop "works itself through" the whole
matrix and adds everytimes one row, so in the last loop, the whole data
matrix is used. The standardization within the loop is done using the
"scale" function. 
 
Now, my problem is that with all the 180 variables, either the for-loop or
the scale function does not work properly, as the resulting matrix after the
standardization does not have the same dimensions anymore as it had before.
The matrix is no longer a 180*470 matrix, but a 180*130 matrix. If, however,
I include only 130 variables instead of 180, the result is correct, the
dimensions are right and each column indeed has mean zero and sd one. 
 
Can anyone please tell me, why this problem appears? Would there be a way
that gives the same result without using a for-loop?
 
Thanks
 
 
 
 

	[[alternative HTML version deleted]]


