Re: [R] Omitting repeated occurrence in a string

2013-02-06 Thread David Winsemius
On Feb 6, 2013, at 11:24 AM, David Winsemius wrote: > > On Feb 6, 2013, at 8:46 AM, Christofer Bogaso wrote: > >> Hello again, >> >> I was looking for some way on How to delete repeated appearance in a >> String. Let say I have following string: >> >> Text <- "ahsgdvasgAbcabcsdahj" >> >> Her

Re: [R] Omitting repeated occurrence in a string

2013-02-06 Thread Eik Vettorazzi
Hi Christopher, what is the rule to omit "ah" which is also repeated in Text? The following might be a start: Text <- "ahsgdvasgAbcabcsdahj" #finds first repetion of substrings of length 2 or more, here "ah" gsub("(?i)([a-z]{2,})(.*)\\1","\\1\\2",Text,perl=T) #finds all repetions of substrings of

Re: [R] Omitting repeated occurrence in a string

2013-02-06 Thread David Winsemius
On Feb 6, 2013, at 8:46 AM, Christofer Bogaso wrote: > Hello again, > > I was looking for some way on How to delete repeated appearance in a > String. Let say I have following string: > > Text <- "ahsgdvasgAbcabcsdahj" > > Here you see "Abc" appears twice. But I want to keep only 1 > occurrenc

[R] Omitting repeated occurrence in a string

2013-02-06 Thread Christofer Bogaso
Hello again, I was looking for some way on How to delete repeated appearance in a String. Let say I have following string: Text <- "ahsgdvasgAbcabcsdahj" Here you see "Abc" appears twice. But I want to keep only 1 occurrence. Therefore I need that: Text_result <- "ahsgdvasgAbcsdahj" (i.e. the f