Re: [R] substring and paste character with a for loop

2011-02-03 Thread Chris82
Oh, that's of course a better solution. I've never red or heard about "gsub". Thanks a lot! -- View this message in context: http://r.789695.n4.nabble.com/substring-and-paste-character-with-a-for-loop-tp3258449p3258485.html Sent from the R help mailing list archive at Nabble.com. _

Re: [R] substring and paste character with a for loop

2011-02-03 Thread Eik Vettorazzi
Hi Chris, 'gsub' does exactly what you want: gsub(",","",text) so there is no need for a loop. Btw. your loop assigns a new value to m in each step and you see only the last assignment. you could do something like m <- paste(m,substring(text,i,i+2),sep = "") hth Am 03.02.2011 17:35, schrieb C

Re: [R] substring and paste character with a for loop

2011-02-03 Thread Ben Bolker
Chris82 gmx.de> writes: > > > Hello R users, > > I have a little problem with a for loop. > Below there is an simple example of my problem. > > I want to delet the commas in the character string. Fore this reason I > create a for loop to unpick the string and rebuild him without the commas. >

[R] substring and paste character with a for loop

2011-02-03 Thread Chris82
Hello R users, I have a little problem with a for loop. Below there is an simple example of my problem. I want to delet the commas in the character string. Fore this reason I create a for loop to unpick the string and rebuild him without the commas. The problem is, that "paste" does not work in