> 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:
> 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)
>>>
>>>
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
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
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
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
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
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
> 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
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
10 matches
Mail list logo