Re: [R] writing a matrix in a file

2010-06-02 Thread Sean Anderson
On 10-06-02 10:34 AM, amir wrote: 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? ... Matrix:

Re: [R] writing a matrix in a file

2010-06-02 Thread Jorge Ivan Velez
Hi Amir, Here is a suggestion: write.table(yourmatrix, "mymatrix.txt", col.names = FALSE, row.names = FALSE, sep = "\t", quote = FALSE) After executing this, you will see a "mymatrix.txt" file in your working directory. Here, typing getwd() in the R console may also help. Do not forget to take a

Re: [R] writing a matrix in a file

2010-06-02 Thread jim holtman
try this: > x <- matrix(1:25,5) > x [,1] [,2] [,3] [,4] [,5] [1,]16 11 16 21 [2,]27 12 17 22 [3,]38 13 18 23 [4,]49 14 19 24 [5,]5 10 15 20 25 > write.table(x, file='') "V1" "V2" "V3" "V4" "V5" "1" 1 6 11 16 21 "2" 2 7 12 17

[R] writing a matrix in a file

2010-06-02 Thread amir
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: 55 -1 -1 -1 -1 88