Hi Alex,

try this

mfile <- "c:\\ex01.txt"
nperm <- 12

sDate <- paste("date: ", "2009-12-13", sep="")
sFile <- paste("filename: ", mfile, sep="")
sPerm <- paste("number of permutations: ", nperm, sep="")

mt <- matrix(1:10, 2)

sink(mfile)
  cat(sDate, "\n")
  cat(sFile, "\n")
  cat(sPerm, "\n")
  cat("-----------------------------", "\n\n")
  print(mt)
sink()

Best
Patrick


Walther, Alexander schrieb:
Dear list,

I would like to export a matrix to a TXT-File by using write.csv (not
necessarily). Is there a way to add a header (with additional
informations concerning the project) spanning multiple lines to this
file before the actual data are listed up? Should look like this:



date:
filename:
number of permutations:

------------

data (as a matrix)



Any suggestions? Thnx in advance.


cheers

Alex

______________________________________________
R-help@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.

______________________________________________
R-help@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.

Reply via email to