One way might be to use a connection and `writeLines'. For example:

 a <- matrix(1:8, byrow = TRUE, ncol = 4)
 a
    [,1] [,2] [,3] [,4]
[1,]    1    2    3    4
[2,]    5    6    7    8
 con <- file("testfile.txt", "w")
 writeLines("#data", con)
 write(a, con, ncol = 4)
 close(con)


-roger


michael kirschbaum wrote:

Hi I got a problem with creating a textfile:
how can I create a textfile, which has a headline like:


#data1
1 2 3 4 5 6 7 8


the problem is, how to bind text and matrix, so that the
"read.table"-function
will ignore the text and read the numbers.

Thank you for help
Michael





______________________________________________ [EMAIL PROTECTED] mailing list https://www.stat.math.ethz.ch/mailman/listinfo/r-help

Reply via email to