[R] To add text in a matrix
Don MacQueen
macq at llnl.gov
Thu Jan 14 16:46:39 CET 2010
In R, see ?connection for information about functions similar to
matlab's fopen.
If what you're trying to do is write information and the matrix to a
file, then you can at least get started with something along the
lines of:
cat('This is my information\nand a second line of it\n',file='myfile')
write.table(mymatrix, 'myfile',append=TRUE)
See also the sink() function
-Don
At 11:04 AM +0100 1/14/10, <carferper at alum.us.es> wrote:
>Dear colleagues,
>
>I would need to add text (some rows of information) in a matrix. For
>example, given this matrix
>
>
>1 2 3
>4 5 6
>7 8 9
>
>I would need to add this info:
>
>THIS IS AN EXAMPLE
>OF a 3x3 MATRIX
>1 2 3
>4 5 6
>7 8 9
>
>
>I have been looking for a function that works similar to "fopen" in
>matlab, but unfortunately I have not found It in R.
>
>Thank you in advance for your help!
>
>Carlos Fernandez
>
>______________________________________________
>R-help at r-project.org mailing list
>https://*stat.ethz.ch/mailman/listinfo/r-help
>PLEASE do read the posting guide http://*www.*R-project.org/posting-guide.html
>and provide commented, minimal, self-contained, reproducible code.
--
--------------------------------------
Don MacQueen
Environmental Protection Department
Lawrence Livermore National Laboratory
Livermore, CA, USA
925-423-1062
More information about the R-help
mailing list