Re: [R] pasting elements of one character vector together

2011-09-20 Thread Marion Wenty
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 > 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 y

Re: [R] pasting elements of one character vector together

2011-09-20 Thread Sarah Goslee
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,]15 [2,]26 [3,]37 [4,]48 > paste(testmat, collapse=" ") [1] "1 2 3 4

Re: [R] pasting elements of one character vector together

2011-09-20 Thread Eik Vettorazzi
Hi marion, just transpose the matrix: mm<-matrix(LETTERS[1:20],nrow=5) paste(t(mm),collapse="") or - if you want the result seperated by rows apply(mm,1,paste,collapse="") cheers Am 20.09.2011 11:55, schrieb Marion Wenty: > I have another question concerning the paste command: > > now instead o

Re: [R] pasting elements of one character vector together

2011-09-20 Thread Marion Wenty
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 eleme

Re: [R] pasting elements of one character vector together

2011-09-19 Thread Marion Wenty
hello michael and dimitris, yes, this was it! now i understand this collapse-argument. thank you very much. marion 2011/9/19 Dimitris Rizopoulos > Try this: > > object <- c("Hello", "World") > paste(object, collapse = " ") > > > I hope it helps. > > Best, > Dimitris > > > > > On 9/19/2011 3:58 P

Re: [R] pasting elements of one character vector together

2011-09-19 Thread Dimitris Rizopoulos
Try this: object <- c("Hello", "World") paste(object, collapse = " ") I hope it helps. Best, Dimitris On 9/19/2011 3:58 PM, Marion Wenty wrote: hello, i am familiar with the paste command with which i can paste for exaple: object<- "Hello" paste(object,"World") now i would like to be ab

Re: [R] pasting elements of one character vector together

2011-09-19 Thread R. Michael Weylandt
paste(...,collapse=" ") Michael Weylandt On Mon, Sep 19, 2011 at 9:58 AM, Marion Wenty wrote: > hello, > > i am familiar with the paste command with which i can paste for exaple: > > object <- "Hello" > paste(object,"World") > > now i would like to be able to paste all the elements of the same v