hi eik, mark and sarah, thank you for your help!
i was looking for the t-command but in the end the apply-command did the trick. marion 2011/9/20 Sarah Goslee <sarah.gos...@gmail.com> > It isn't entirely clear to me what you want, but here are all the > possibilities > I could think of. I hope one of them does what you want. > > > testmat <- matrix(1:8, ncol=2) > > testmat > [,1] [,2] > [1,] 1 5 > [2,] 2 6 > [3,] 3 7 > [4,] 4 8 > > paste(testmat, collapse=" ") > [1] "1 2 3 4 5 6 7 8" > > paste(t(testmat), collapse=" ") > [1] "1 5 2 6 3 7 4 8" > > apply(testmat, 1, paste, collapse=" ") > [1] "1 5" "2 6" "3 7" "4 8" > > apply(testmat, 2, paste, collapse=" ") > [1] "1 2 3 4" "5 6 7 8" > > Sarah > > On Tue, Sep 20, 2011 at 5:55 AM, Marion Wenty <marion.we...@gmail.com> > wrote: > > I have another question concerning the paste command: > > > > now instead of a vector I would like to paste the elements of a matrix > > together, which works in the same: > > > > Mypastedmatrix <- paste(Mymatrix,collapse="") > > > > My problem now is that the program does this BY COLUMN, but I would like > to > > have the elements pasted together BY ROW. > > > > Could anybody help me with this? > > > > Marion > > > -- > Sarah Goslee > http://www.functionaldiversity.org > [[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.