Hello
I am using 2 for loops to find the difference between all rows of a matrix.
I  need to store it to a csv file. I have written this:
for (i in 0:length(datamat)){
for (j in i+1:length(datamat)){
x<-datamat[i,]-datamat[j,];
y<-as.data.frama(x);
write.csv(y, "dif.csv")
}}

datamat is the original datamatrix and dif is the file i want to copy the
results to.
However, when i open this file, I find it empty. What is it that I'm doing
wrong? Also, can I store the results of this loop in another matrix? If
then, how? I am new to R and not skilled in other programming languages.
Any help is appreciated!
Thank you

	[[alternative HTML version deleted]]

