[R] writing a matrix in a file

amir amir at ac.upc.edu
Wed Jun 2 15:34:24 CEST 2010


Hi,

I want to write a matrix (n*m) in a file (Text file)  such that the file
will be as Result file (below).
I use the below command but it write all numbers in one column,

> write(paste(matrixname),file="test.txt",append=TRUE)

how can I do this?

Result file:
5    5   -1   -1   -1   -1
8    8    2    7    6    5
6    6    8    2    7    5

Matrix:
     [,1] [,2] [,3] [,4] [,5] [,6]
[1,]    5    5   -1   -1   -1   -1
[2,]    8    8    2    7    6    5
[3,]    6    6    8    2    7    5

Regards,
Amir



More information about the R-help mailing list