[R] writing data to file (was: no subject)
Liaw, Andy
andy_liaw at merck.com
Tue Jul 15 17:18:06 CEST 2003
1. Please use an informative subject line.
2. Try something like the following:
> m <- matrix(1:8, 2, 4, byrow=TRUE)
> outfile <- file("test.txt", open="w")
> writeLines("#data1", outfile)
> write(t(m), outfile, ncol=ncol(m))
> close(outfile)
> file.show("test.txt")
Consult the relevant help pages for the functions used above.
HTH,
Andy
> -----Original Message-----
> From: michael kirschbaum [mailto:kirschenmichel at gmx.de]
> Sent: Tuesday, July 15, 2003 9:56 AM
> To: r-help at stat.math.ethz.ch
> Subject: [R] (no subject)
>
>
> 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
>
> --
> 2
>
> ______________________________________________
> R-help at stat.math.ethz.ch mailing list
> https://www.stat.math.ethz.ch/mailman/listinfo> /r-help
>
------------------------------------------------------------------------------
Notice: This e-mail message, together with any attachments, ...{{dropped}}
More information about the R-help
mailing list