Re: [R] Flummoxed by gsub().

2017-08-24 Thread David Winsemius
> On Aug 24, 2017, at 10:20 AM, David Winsemius wrote: > > >> On Aug 23, 2017, at 2:29 AM, Rolf Turner wrote: >> >> >> On 23/08/17 18:33, Stefan Evert wrote: >> On 23 Aug 2017, at 07:45, Rolf Turner wrote:

Re: [R] Flummoxed by gsub().

2017-08-24 Thread David Winsemius
> On Aug 23, 2017, at 2:29 AM, Rolf Turner wrote: > > > On 23/08/17 18:33, Stefan Evert wrote: > >>> On 23 Aug 2017, at 07:45, Rolf Turner wrote: >>> >>> My reading of ?regex led me to believe that >>> >>>gsub("[:alpha:]","",x) >>> >>>

Re: [R] Flummoxed by gsub().

2017-08-23 Thread William Dunlap via R-help
Note that the "doubled brackets" are not essential to this usage. [:characterClass:] is recognized inside of square brackets as a shortcut for listing a bunch of characters. You can mix it with other characters or character classes inside a set of square brackets. E.g., the following pattern

Re: [R] Flummoxed by gsub().

2017-08-23 Thread Rolf Turner
On 24/08/17 02:46, Bert Gunter wrote: Inline. -- Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Wed, Aug 23, 2017 at 2:29 AM, Rolf Turner

Re: [R] Flummoxed by gsub().

2017-08-23 Thread Bert Gunter
Inline. -- Bert Bert Gunter "The trouble with having an open mind is that people keep coming along and sticking things into it." -- Opus (aka Berkeley Breathed in his "Bloom County" comic strip ) On Wed, Aug 23, 2017 at 2:29 AM, Rolf Turner wrote: > > On 23/08/17

Re: [R] Flummoxed by gsub().

2017-08-23 Thread Rolf Turner
On 23/08/17 18:41, PIKAL Petr wrote: Hi Rolf I am not at all an expert in regex but gsub("[[:alpha:]]","",x) Works as you expected. Do not ask me why. Thanks Petr. Stefan Evert's explanation clarified the issue. Which I must say *needed* some clarification! cheers, Rolf -- Technical

Re: [R] Flummoxed by gsub().

2017-08-23 Thread Rolf Turner
On 23/08/17 18:33, Stefan Evert wrote: On 23 Aug 2017, at 07:45, Rolf Turner wrote: My reading of ?regex led me to believe that gsub("[:alpha:]","",x) should give the result that I want. That's looking for any of the characters a, l, p, h, : . OK. I see

Re: [R] Flummoxed by gsub().

2017-08-23 Thread PIKAL Petr
23, 2017 7:46 AM > To: r-help mailing list <r-help@r-project.org> > Subject: [R] Flummoxed by gsub(). > > > I have a vector (say "x") of the form > > [1] "mung5" "mung10" "mung20" "gorp5" "gorp10" "gor

Re: [R] Flummoxed by gsub().

2017-08-23 Thread Stefan Evert
> On 23 Aug 2017, at 07:45, Rolf Turner wrote: > > My reading of ?regex led me to believe that > >gsub("[:alpha:]","",x) > > should give the result that I want. That's looking for any of the characters a, l, p, h, : . What you meant to say was

[R] Flummoxed by gsub().

2017-08-22 Thread Rolf Turner
I have a vector (say "x") of the form [1] "mung5" "mung10" "mung20" "gorp5" "gorp10" "gorp20" I want to extract just the numbers (strings of digits) that appear at the end of the strings in "x". My reading of ?regex led me to believe that gsub("[:alpha:]","",x) should give the