On Mon, Dec 14, 2009 at 4:37 PM, Walther, Alexander <
awaltherm...@googlemail.com> wrote:

> 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
>
>
>

Hi,

?write.table and the argument "append" should be of help.
example:

> sink("test.csv")
> cat("-----------------------------")
> cat("\n")
> cat("This is \n a test of header")
> cat("\n")
> cat("-----------------------------")
> cat("\n")
> sink()
>
write.table(matrix(rnorm(100),nrow=10),file="test.csv",append=TRUE,sep=",")


regards,
Gustaf


-- 
Gustaf Rydevik, M.Sci.
tel: +46(0)703 051 451
address:Essingetorget 40,112 66 Stockholm, SE
skype:gustaf_rydevik

        [[alternative HTML version deleted]]

______________________________________________
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