Dear Julien, Try sink(): matrixA <- matrix(0,5,4) matrixB <- matrix(1,7,13) matrixList <- list(matrixA,matrixB) names(matrixList) <- c("matrixA", "matrixB")
sink("yourname.txt") matrixList sink() See ?sink for more information. HTH, Jorge On Mon, Jul 20, 2009 at 1:02 PM, julien cuisinier <j_cuisin...@hotmail.com>wrote: > > Hi list, > > > > > > > > How to save a list content into a text file? > > > > Please consider example below, I have two numeric matrices that I bundle > into a list & give each list element a name > > > > Example: > > > matrixA <- matrix(0,5,4) > > matrixB <- matrix(1,7,13) > > matrixList <- list(matrixA,matrixB) > > > names <- c("Matrix A","Matrix B") > > > names <- names(matrixList) > > > > How could I get the list in a txt as below: > > " > > Matrix A > > (Matrix A element 1,1), (Matrix A element 1,2), ... > > (Matrix A element 2,1), (Matrix A element 2,2), ... > > ... > > > > Matrix B > > (Matrix B element 1,1), (Matrix B element 1,2), ... > > (Matrix B element 2,1), (Matrix B element 2,2), ... > > ... > > " > > > > > > Write or write.table or write.csv did not help as it complains the matrices > are not of equal size > > > > Any help/direction appreciated > > > > > > many thanks > > > > regards, > > Julien Cuisinier > > > > > > > > > > > > " > > > > _________________________________________________________________ > [[elided Hotmail spam]] > > [[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. > [[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.