Re: [R] String split and concatenation

2010-09-30 Thread Gabor Grothendieck
On Wed, Sep 29, 2010 at 4:15 AM, Steven Kang wrote: > x <- rep(letters[1:3], 2) > > Are there any ways to transform & assign the above as the one shown below > to an object? (in exact format; i.e length of 1 & class of character), > i.e >>x > "('a', 'b', 'c', 'a', 'b', 'c')" > > Highly appreciate

Re: [R] String split and concatenation

2010-09-30 Thread Greg Snow
> Cc: r-help@r-project.org > Subject: Re: [R] String split and concatenation > > > paste( '(', paste( "'", rep(letters[1:3],2), "'", sep="", > collapse=','), ')', sep="" ) > [1] "('a',

Re: [R] String split and concatenation

2010-09-29 Thread Greg Snow
- > From: r-help-boun...@r-project.org [mailto:r-help-boun...@r- > project.org] On Behalf Of Steven Kang > Sent: Wednesday, September 29, 2010 2:16 AM > To: bill.venab...@csiro.au > Cc: r-help@r-project.org > Subject: Re: [R] String split and concatenation > > x <- rep(le

Re: [R] String split and concatenation

2010-09-29 Thread Steven Kang
r-project.org] > On Behalf Of Steven Kang > Sent: Wednesday, 29 September 2010 3:11 PM > To: r-help@r-project.org > Subject: [R] String split and concatenation > > Hi R users, > > > I desire to transform the following vector consisting of repeated > characters > >

Re: [R] String split and concatenation

2010-09-28 Thread Bill.Venables
dump("x", file = "x.R") file.show("x.R") will get you most of the way. -Original Message- From: r-help-boun...@r-project.org [mailto:r-help-boun...@r-project.org] On Behalf Of Steven Kang Sent: Wednesday, 29 September 2010 3:11 PM To: r-help@r-project.org

Re: [R] String split and concatenation

2010-09-28 Thread Ista Zahn
Hi Steven, This should do it: paste('"', unlist(strsplit(x, split="")), c(rep('",', length(x)-1), ""), sep="") -Ista On Wed, Sep 29, 2010 at 1:11 AM, Steven Kang wrote: > Hi R users, > > > I desire to transform the following vector consisting of repeated characters > > x <- rep(letters, 3) > in

[R] String split and concatenation

2010-09-28 Thread Steven Kang
Hi R users, I desire to transform the following vector consisting of repeated characters x <- rep(letters, 3) into this exact format (i.e a single string containing each characters in quotation mark separated by comma between each; al ). ("a", "b", "c", "d", "a", "b", "c", "d",